Graphics, Figures & TablesTwo tables embedded with same width

Information and discussion about graphics, figures & tables in LaTeX documents.
Sundial
Posts: 57
Joined: Thu Apr 19, 2012 7:28 pm

Two tables embedded with same width

Post by Sundial »

Hi,
I'ld like to have the following tables joined with a unique frame width:

Code: Select all

\documentclass[a4paper,11pt] {article}
\usepackage [latin1]{inputenc}  
\usepackage[T1]{fontenc}
\usepackage[english]{babel}                 
\usepackage{amsmath}         
%-----------------
\usepackage{supertabular}
\begin{document}
\begin{center}
\begin{supertabular}{|c c c c c c c|} 
\hline
\textbf{Times} & & \textbf{RAAN} &  & & \textbf{Dec} &  \\ 
\hline
 & |$\;H$ & $M$ & $S$ & | $\;\,\circ$ & $\prime$ & $\prime \prime$ \\
\hline
\hline
  11:40:28 & | 00 & 03 & 45.58 & | 18 & 40 & 03.78 \\ 
  11:48:28 & | 03 & 00 & 06.18 & | 35 & 39 & 53.07 \\ 
  11:52:28 & | 04 & 31 & 32.80 & | 36 & 59 & 47.70 \\ 
\hline
\end{supertabular}
%-----------------------------------------
\begin{supertabular}{|l l |}
\hline
\textbf{Date} & \textbf{Site Geodetic Coords} \\
\hline
Aug.20,2012 | & $\lambda=-110^\circ \qquad \phi=40^\circ \qquad H=2000\;m$\\
\hline
\end{supertabular}
\end{center}
\end{document}
At the moment, the width of both tables depends on central fields (RAAN, Site Geodetic Coords) and I cannot control the frame without modifying the words.
What I need is red marked in the att'd screenshot; thanks in advance
Attachments
scr01.png
scr01.png (32.83 KiB) Viewed 9001 times

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

And: Currently, Packt sells ebooks for $4.99 each if you buy 5 of their over 1000 ebooks. If you choose only a single one, $9.99. How about combining 3 LaTeX books with Python, gnuplot, mathplotlib, Matlab, ChatGPT or other AI books? Epub and PDF. Bundle (3 books, add more for higher discount): https://packt.link/MDH5p

svend_tveskaeg
Posts: 478
Joined: Sun Jul 12, 2009 5:31 am

Two tables embedded with same width

Post by svend_tveskaeg »

Before I come up with a possible idea, I would like to know if $H$, $M$, and $S$ means hours, minutes, and seconds.

Furthermore, does $2000\;m$ means 2000 metres?

This depends on how the entries should be typeset.

Update
I assume that my suggestions are correct. Here is now an example.

Code: Select all

\documentclass{article}

\usepackage{booktabs,array}
\usepackage{siunitx}
\sisetup{minimum-integer-digits=2}

\begin{document}

\begin{table}
\centering
\caption{Data.}
\label{horse}
\begin{tabular}{
 c
 !{\quad}
 S[table-format=2.0]
 S[table-format=2.0]
 S[table-format=2.2]
 !{\quad}
 S[table-format=2.0]
 S[table-format=2.0]
 S[table-format=2.2]
}
\toprule
Times & \multicolumn{3}{c}{RAAN} & \multicolumn{3}{c}{Dec}\\
      & \si{\hour} & \si{\minute} & \si{\s} & \si{\degree} & \si{\arcminute} & \si{\arcsecond} \\
\midrule
11:40:28 & 00 & 03 & 45.48 & 18 & 40 & 03.78 \\
11:48:28 & 03 & 00 & 06.18 & 35 & 39 & 53.07 \\
11:52:28 & 04 & 31 & 32.80 & 36 & 59 & 47.70 \\
\midrule
Date & \multicolumn{6}{c}{Site Geodetic Coordinates}\\
Aug.~20, 2012 & \multicolumn{2}{c}{$\lambda = \SI{-110}{\degree}$} & \multicolumn{2}{c}{$\phi = \SI{40}{\degree}$} & \multicolumn{2}{c}{$H = \SI{2000}{\m}$} \\
\bottomrule
\end{tabular}
\end{table}

This is Table~\ref{horse}.

\end{document}
I had some troubles myself, so I got some help on {TeX} SE.
``In the game of chess, you can never let your adversary see your pieces.''
-- Zapp Brannigan, Futurama (season 1, episode 4)
Sundial
Posts: 57
Joined: Thu Apr 19, 2012 7:28 pm

Two tables embedded with same width

Post by Sundial »

So beautiful, svend! The table looks better&better without vertical sides, thank you very much.

Besides, you are right.(H,M,S) are hours, minutes and seconds of Right Ascension of Ascending Node referred to a terrestrial satellite seen in the given times and 2000 m are meters of location above sea level.
User avatar
svend_tveskaeg
Posts: 478
Joined: Sun Jul 12, 2009 5:31 am

Two tables embedded with same width

Post by svend_tveskaeg »

Interesting infomation!

By the way, it is a good idea to use

Code: Select all

\usepackage[tableposition=top]{caption}
in order to get the spacing between the caption and the corresponding table correct. Then you can also costumize the caption.

P.S. Remember to mark the topic as solved.
``In the game of chess, you can never let your adversary see your pieces.''
-- Zapp Brannigan, Futurama (season 1, episode 4)
Sundial
Posts: 57
Joined: Thu Apr 19, 2012 7:28 pm

Two tables embedded with same width

Post by Sundial »

Hi,
just downloaded caption-eng.pdf, and I believe to find there the tiny trouble I still need to solve. Nevertheless, for the sake of other users, please let me know how to cut into two rows the title of Table 1 (see attachment).

About the tag [solved] you advice me to add, I'm dubious that this forum uses such a policy. In fact, I've recently done this insertion in one of my previous posts and ... someone erased it, without notice!

Thanks in advance
Attachments
scr02.png
scr02.png (24.58 KiB) Viewed 8974 times
User avatar
svend_tveskaeg
Posts: 478
Joined: Sun Jul 12, 2009 5:31 am

Two tables embedded with same width

Post by svend_tveskaeg »

Here is an example:

Code: Select all

\documentclass{article}

\usepackage[T1]{fontenc}
\usepackage[tableposition=top]{caption}
\usepackage{booktabs,array}
\usepackage{siunitx}
\sisetup{minimum-integer-digits=2}

\DeclareCaptionLabelSeparator{CapSpace}{:\quad}
\captionsetup{
  font=small,
  labelfont=sc,
  labelsep=CapSpace,
  width=0.7\textwidth
}

\begin{document}

\begin{table}
\centering
\caption{A vert long caption to show the automatic linebreak after \texttt{0.7\textbackslash textwidth}.}
\label{horse}
\begin{tabular}{
 c
 !{\quad}
 S[table-format=2.0]
 S[table-format=2.0]
 S[table-format=2.2]
 !{\quad}
 S[table-format=2.0]
 S[table-format=2.0]
 S[table-format=2.2]
}
\toprule
Times & \multicolumn{3}{c}{RAAN} & \multicolumn{3}{c}{Dec}\\
      & \si{\hour} & \si{\minute} & \si{\s} & \si{\degree} & \si{\arcminute} & \si{\arcsecond} \\
\midrule
11:40:28 & 00 & 03 & 45.48 & 18 & 40 & 03.78 \\
11:48:28 & 03 & 00 & 06.18 & 35 & 39 & 53.07 \\
11:52:28 & 04 & 31 & 32.80 & 36 & 59 & 47.70 \\
\midrule
Date & \multicolumn{6}{c}{Site Geodetic Coordinates}\\
Aug.~20, 2012 & \multicolumn{2}{c}{$\lambda = \SI{-110}{\degree}$} & \multicolumn{2}{c}{$\phi = \SI{40}{\degree}$} & \multicolumn{2}{c}{$H = \SI{2000}{\m}$} \\
\bottomrule
\end{tabular}
\end{table}

This is Table~\ref{horse}.

\end{document}
``In the game of chess, you can never let your adversary see your pieces.''
-- Zapp Brannigan, Futurama (season 1, episode 4)
Sundial
Posts: 57
Joined: Thu Apr 19, 2012 7:28 pm

Two tables embedded with same width

Post by Sundial »

Oh, it's fine! It works very well, but unfortunately conflicts arise with figures of my document, despite I've repeated several times the compilation command pdflatex filename. See att'd screenshot.
Thx

PS: so, the problem is still unsolved! Only using the original (and weird) table figures+tab references work properly.
Attachments
scr04.png
scr04.png (53.77 KiB) Viewed 8971 times
User avatar
svend_tveskaeg
Posts: 478
Joined: Sun Jul 12, 2009 5:31 am

Two tables embedded with same width

Post by svend_tveskaeg »

That is a reference problem: Try to delete all the AUX files and then compile three times.

If that doesn't help, it is because \label{<name>} doesn't match \ref{<name>}.
``In the game of chess, you can never let your adversary see your pieces.''
-- Zapp Brannigan, Futurama (season 1, episode 4)
Sundial
Posts: 57
Joined: Thu Apr 19, 2012 7:28 pm

Two tables embedded with same width

Post by Sundial »

Nothing to do, svend! This is the script I've used in linux/ubuntu environment:

Code: Select all

#!/bin/sh
rm *.aux *.log
pdflatex $1
rm *.aux *.log
pdflatex $1   
rm *.aux *.log
pdflatex $1
rm *.aux *.log
echo " End compilation ... wait for PDF file"
evince $1.pdf
By inserting as $1 the original file, figures+tabs are well connected, while with the new one I obtained the same failure.
Thx a lot.
User avatar
svend_tveskaeg
Posts: 478
Joined: Sun Jul 12, 2009 5:31 am

Re: Two tables embedded with same width

Post by svend_tveskaeg »

I am not sure understand what you are saying.

Well, as I said, the problem has something to do with the references.
``In the game of chess, you can never let your adversary see your pieces.''
-- Zapp Brannigan, Futurama (season 1, episode 4)
Post Reply