\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).
Related
When I insert my table into latex I get an overfull /hbox error and cannot figure out how to change the width without changing the structure of my table. The code of my table follows as such:
\begin{center}
\begin{tabular}{||c c c||}
\hline
Function() & Computational Cost (Gas)& USD Equivalent \\ [0.5ex]
\hline\hline
Total Deployment & 8342204 & 1.195559526 \\
\hline
Security Registration & 3849155 & 0.5516400614 \\
\hline
\textit{MintSecurity} & 76293 & 0.01093389983 \\
\hline
\textit{TransferFrom} & 55146 & 0.007903226248 \\
\hline
\textit{Swap} & 89343 & 0.0128041552 \\
\hline
\textit{AddLiquidity} & 185368 & 0.02656593847 \\
\hline
\textit{Remove Liquidity} & 67137 & 0.009621711468 \\ [1ex]
\hline
\end{tabular}
\end{center}
In the template you are using, tables are set in a smaller font size, so the problem is solved automatically if you use a table environment instead of center.
In addition, you can use the tabularray package, so the table will automatically match the text width:
\documentclass[conference]{IEEEtran}
\usepackage{tabularray}
\usepackage{lipsum}
\begin{document}
\lipsum[2]
\begin{table}[htbp]
\begin{tblr}{||c X[c] c||}
\hline
Function() & Computational Cost (Gas)& USD Equivalent \\
\hline\hline
Total Deployment & 8342204 & 1.195559526 \\
\hline
Security Registration & 3849155 & 0.5516400614 \\
\hline
\textit{MintSecurity} & 76293 & 0.01093389983 \\
\hline
\textit{TransferFrom} & 55146 & 0.007903226248 \\
\hline
\textit{Swap} & 89343 & 0.0128041552 \\
\hline
\textit{AddLiquidity} & 185368 & 0.02656593847 \\
\hline
\textit{Remove Liquidity} & 67137 & 0.009621711468 \\
\hline
\end{tblr}%
\end{table}
\lipsum[2]
\end{document}
I have a table need to write in latex, then I need to use the following code to make a table.
\begin{table}[]
\begin{tabular}{|l|r|}
\hline
\textbf{Item} & \textbf{Amount} \\ \hline
User Account & 15,763 \\ \hline
Original Post & 56,797 \\ \hline
Post Reply & 1,515,618 \\ \hline
Post (Original+Reply) & 1,572,415 \\ \hline
Adopted Post & 88,240 \\ \hline
\end{tabular}
\end{table}
However, it cannot set a specific width. When I want to write \begin{tabular}{|l{3.8}|r{3.8}|}, it does not work.
If I use p{3.8cm}, it does work. However, it does not keep right but left.
I want to make a specific width from the table and set it to keep right instead of the left.
Can anyone help me? Thanks!!
\documentclass{article}
\usepackage{array}
\begin{document}
\begin{table}[]
\begin{tabular}{|l|>{\raggedleft\arraybackslash}p{3.8cm}|}
\hline
\textbf{Item} & \textbf{Amount} \\ \hline
User Account & 15,763 \\ \hline
Original Post & 56,797 \\ \hline
Post Reply & 1,515,618 \\ \hline
Post (Original+Reply) & 1,572,415 \\ \hline
Adopted Post & 88,240 \\ \hline
\end{tabular}
\end{table}
\end{document}
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}}
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 know that if you define a width in a table's column, you can get automatic word-wrapping.
However, I need to control where newlines should happen in a specific table cell.
Thus, how can I insert manual line breaks in a LaTeX table cell?
Usually, you use a column definition like p{3cm} instead of l, and then use \newline instead of \\ in the cell body.
You could do it like this:
\documentclass{report}
\begin{document}
\begin{tabular}{|l|l|}
\hline
A & B \\
& C \\
\hline
D & E \\
\hline
\end{tabular}
\end{document}
which produces:
The command \shortstack can be used to wrap cell content and use \\ inside it:
\begin{tabular}{|l|l|}
\hline
one line & \shortstack{two\\ lines} \\
\hline
XX & YYY \\
\hline
\end{tabular}
EDIT: however I just realised that interline spacing might differ between your columns. So it's not the prettiest solution.
It can be achieved by using \newline. Since, the accepted answer did not have any sample snippet, a working sample is provided here:
\begin{tabular}{p{2cm} p{10cm}}
\em{Programming} \textsc{languages} & Java, Node.js, Python, Clojure \\
\newline & \newline \\
\em{Development systems} & Concurrent Programming, Design Patterns
\end{tabular}
You can do like Bart suggested above and combine with multirow to centralize single line texts.
\begin{table}[h]
\centering
\caption{Optimized models (Softmax) final results with confidence intervals.}
\begin{tabular}{|c|c|c|c|c|}
\hline
\multirow{2}*{Architecture} & Batch & N. & Learning & \multirow{2}*{Micro-F1} \\
& size & epochs & rate & \\
\hline
ResNet50& 64 & 60 & $5\times10^{-3}$ & $(\textbf{0.7683} \pm 0.0223)$ \\
\hline
ResNet152\_V2& 64 & 40 & $5\times10^{-4}$ & $(0.6698 \pm 0.0467)$\\
\hline
\end{tabular}
\label{final_result_softmax}
\end{table}
Yields:
\newline works to break a line within a cell in tabularx environment.