I need to add a reference under the title of my table and this was my code. However, the reference appear in the Table content. I need just to add reference under the title of the table before the tabular without adding it to the table content.
\begin{document}
\begin{table}[]
\fontsize{8}{10}\selectfont
\tabcolsep=0.3cm
\centering
\caption{Dataset statistics \cite{reference_here}}
%\vspace{-.2cm}
\label{table:dataset}
\begin{tabular}{#{}lr#{}}
\toprule
\textbf{Statistic} & \textbf{Count} \\ \midrule
\# of A & 800 \\
\# of B & 36,681 \\
\# of C & 36,681 \\
\# of D & 112,480 \\
Total E & 723,360 \\
\bottomrule
\end{tabular}
\vspace{-.3cm}
\end{table}
\end{document}
You can define two different caption texts, one for the actual table and one for the list of tables:
\caption[version for LoT]{Dataset statistics \cite{reference_here}}
Related
I am new in Latex, I create a table
\begin{table}[!ht]
\centering
\caption{Cities analyzed in this study}
\begin{adjustbox}{max width=\textwidth}
\begin{tabular}{|l|c|c|c|c|c|c|c|c|c|}
\hline
City & Number of & Number of & \multicolumn{2}{c}{Transportation type} \\
\cline{4-9}
& stations & routes & Bus & Tram & Subway&Rail&Ferry& Cable-car \\
\hline
Adelaide & 7548 & 9234 & 8950 &54 & - & 230 & -&- \\
\hline
But in the top right, the vertical line is not showing. How can I make it appear?
My second question how can I put 'Transportation type' on the center of the cell?
You can add the missing edge by using \multicolumn{6}{c|}{...}, but before you actually use this, please have a look at http://betterposters.blogspot.com/2012/08/the-data-prison.html or https://www.inf.ethz.ch/personal/markusp/teaching/guides/guide-tables.pdf for some guides about nice table layouts. Using vertical lines is really bad style.
Please also don't scale elements that contain text. This will make result in a suboptimal usage of font shapes. If you must make your table smaller, manually choose an appropriate font size.
\documentclass{article}
\begin{document}
\begin{table}[!ht]
\centering
\caption{Cities analyzed in this study}
\begin{tabular}{|l|c|c|c|c|c|c|c|c|c|}
\hline
City & Number of & Number of & \multicolumn{6}{c|}{Transportation type} \\
\cline{4-9}
& stations & routes & Bus & Tram & Subway&Rail&Ferry& Cable-car \\
\hline
Adelaide & 7548 & 9234 & 8950 &54 & - & 230 & -&- \\
\hline
\end{tabular}
\end{table}
\end{document}
I have a table I wish to fit in the margins. I also wish to add both EPS and PPS above the middle of the cells with these two in. I am not sure why adding a caption is not working either. Here is the code:
\begin{tabular}{ |p{3cm}||p{3cm}|p{3cm}|p{3cm}|p{3cm}| }
\multicolumn{5}{c}{} \\
\hline
&EPS:Pre &EPS:Post &PPS:Pre & PPS:Post \\
\hline
Species tested:&13 &15& 43& 43\\
Compounds tested:& 745 & 745& 310& 361 \\
Unique tests:& 193& 193& 406& 407\\
Total experiments:&17,811 &17,929& 107,470& 130,926\\
\hline
\end{tabular}
\label{tab}
Thank you.
There where several problems.
Your table was too large, with the margins and intercolumn spacing. I made a macro to fine adjust column width.
To redefine a column (for instance to center a header), you can use `\multicolumn{1}{c}{header}
\label assigns a number that is used in a numbered environment. It is associated with the table environmenent, not with tabular. The label appears within a caption. Also, the table is centered within the table environment.
\documentclass{article}
\begin{document}
\newcommand{\colwidth}{0.17\textwidth}
\newcommand{\centercolumn}[1]{\multicolumn{1}{c|}{#1}}
\begin{table}
\centering
\begin{tabular}{ |p{3cm}||p{\colwidth}|p{\colwidth}|p{\colwidth}|p{\colwidth}| }
% \multicolumn{5}{c}{} \\ useless, I think
\hline
&\centercolumn{EPS:Pre} &\centercolumn{EPS:Post} &\centercolumn{PPS:Pre} & \centercolumn{PPS:Post} \\
\hline
Species tested:&13 &15& 43& 43\\
Compounds tested:& 745 & 745& 310& 361 \\
Unique tests:& 193& 193& 406& 407\\
Total experiments:&17,811 &17,929& 107,470& 130,926\\
\hline
\end{tabular}
\caption{My table}
\label{tab:1}
\end{table}
\end{document}
I am trying to create a table that has combination of single column and double columns rows? Any idea how can I do that in latex?
See Figure below:
You should set the tabular using the maximum number of columns, and then make some columns span \multicolumn:
\documentclass{article}
\usepackage{tabularx}
\usepackage[nopar]{lipsum}
\begin{document}
\noindent
\begin{tabularx}{\linewidth}{| X | X | X |}
\hline
& Abstract & Direct \\
\hline
Type A & \multicolumn{2}{ p{\dimexpr.6667\linewidth-2\tabcolsep} |}{\lipsum[1]} \\
\cline{2-3}
& A & B \\
\hline
Type B & \multicolumn{2}{ p{\dimexpr.6667\linewidth-2\tabcolsep} |}{\lipsum[2]} \\
\cline{2-3}
& A & B \\
\hline
\end{tabularx}
\end{document}
\begin{center}
\begin{table}[h!]
\centering
\begin{tabular}{|l|l|l|l|}
\hline
Name of the Dataset File & Number of Cases & Number of Records & Primary Key \\
\hline
Detail Interaction & 147,004 & 2400 & Interaction ID \\
\hline
Detail Incident & \\
\hline
Detail Change & \\
\hline
Detail Activity & \\
\hline
\end{tabular}
\caption{Dataset description of the four datasets provided by Rabobank Group ICT.}
\end{table}
\end{center}
The table doesnt fit to the page. Can someone help me in making it in a page. The table has 4 columns and 5 rows.
I'd suggest writing the table in a more elegant way using booktabs, as there seems to be some superfluous information the headers:
\documentclass{article}
\usepackage{booktabs,siunitx}
\begin{document}
\noindent
\begin{tabular}{ l r r l }
\toprule
Dataset Filename & \multicolumn{1}{c}{Cases} & \multicolumn{1}{c}{Records} & Primary Key \\
\midrule
Detail Interaction & \num{147004} & \num{2400} & InteractionID \\
Detail Incident & \num{12345} & \num{20000} & IncidentID \\
Detail Change & \num{12} & \num{412} & ChangeID \\
Detail Activity & \num{7890} & \num{1234567} & ActivityID \\
\bottomrule
\end{tabular}
\end{document}
First of all, your code is missing some &s, in lines 11, 13 and 15: try
\begin{table}[h!]
\centering
\begin{tabular}{|l|l|l|l|}
\hline
Name of the Dataset File & Number of Cases & Number of Records & Primary Key \\
\hline
Detail Interaction & 147,004 & 2400 & Interaction ID \\
\hline
Detail Incident & & & \\% 2 occurrences of & added here
\hline
Detail Change & & & \\% 2 occurrences of & added here
\hline
Detail Activity & & & \\% 2 occurrences of & added here
\hline
\end{tabular}
\caption{Dataset description of the four datasets provided by Rabobank Group ICT.}
\end{table}
In a second instance, I advise you to see if you prefer something like
\begin{tabular}{|p{.3\textwidth}|p{.2\textwidth}|p{.2\textwidth}|p{.2\textwidth}|}
instead of just
\begin{tabular}{|l|l|l|l|}
In this case, you can use \par to get a linebreak inside a cell (for example: Name of the\par Dataset File).
I have a table in LaTeX which spans multiple pages.
I want the top two rows repeated in each page.
How can I do that?
From here:
Tables longer than a single page
[...]
Both longtable and supertabular allow definition of head- and footlines for the table; longtable allows distinction of the first and last head and foot.
[...]
you've got to use the longtable package. Here is an example of the head (source: http://users.sdsc.edu/~ssmallen/latex/longtable.html)
\begin{center}
\begin{longtable}{|l|l|l|}
\caption[Feasible triples for a highly variable Grid]{Feasible triples for highly variable Grid, MLMMH.} \label{grid_mlmmh} \\
\hline \multicolumn{1}{|c|}{\textbf{Time (s)}} & \multicolumn{1}{c|}{\textbf{Triple chosen}} & \multicolumn{1}{c|}{\textbf{Other feasible triples}} \\ \hline
\endfirsthead
\multicolumn{3}{c}%
{{\bfseries \tablename\ \thetable{} -- continued from previous page}} \\
\hline \multicolumn{1}{|c|}{\textbf{Time (s)}} &
\multicolumn{1}{c|}{\textbf{Triple chosen}} &
\multicolumn{1}{c|}{\textbf{Other feasible triples}} \\ \hline
\endhead
\hline \multicolumn{3}{|r|}{{Continued on next page}} \\ \hline
\endfoot
\hline \hline
%here your table content goes
\end{longtable}
\end{center}
\endlastfoot