0

I would like to know how to break line in a table so the text stays the same width as the rest of the text. My code is:

\documentclass[runningheads]{llncs}
\usepackage{graphicx}

\begin{document}
\begin{table}
\caption{Precision variation.}
\centering
\label{tab1}
\begin{tabular}{|c|c|c|c|c|}
\hline
Work & Year & Blockchain Funcionality & Pros & Cons \\
\hline
\cite{song2019} & 2019 & Digital signature storage & Authenticated information & Centralized architecture \\
\cite{shang2018} & 2018 & Information storage & Scratch Information & Unauthenticated information \\
\cite{huckle} & 2017 & Hash/metadata storage & Authenticated information & High cost \\
Our Work & 2019 & Algorithm processing & Reliability e Authenticity & None \\
\hline
\end{tabular}
\end{table}
\end{document}

My output is:

enter image description here

As can be seen, the table exceeds the text with limit. How do i solve this?

2

Instead column's type c you should use ones, which enable to break text in more line. For example p{<width>} or \m{<width>} from array package, X from tabularx package:

\documentclass[runningheads]{llncs}
\usepackage{booktabs, makecell, tabularx}
\setcellgapes{2pt}
\newcolumntype{C}{>{\centering\arraybackslash}X}
\newcolumntype{L}{>{\raggedright\arraybackslash}X}

\begin{document}
\begin{table}
\caption{Precision variation.}
\label{tab1}
    \centering
    \makegapedcells
\begin{tabularx}{\linewidth}{|c|c|*{3}{C|}}
\hline
Work & Year & Blockchain Funcionality & Pros & Cons \\
\hline
\cite{song2019} & 2019 & Digital signature storage & Authenticated information & Centralized architecture \\
\cite{shang2018}& 2018 & Information storage & Scratch Information & Unauthenticated information \\
\cite{huckle}   & 2017 & Hash/metadata storage & Authenticated information & High cost \\
\makecell[t]{Our\\ Work}
                & 2019 & Algorithm processing & Reliability e Authenticity & None \\
\hline
\end{tabularx}
\end{table}
or

\begin{table}
\caption{Precision variation.}
\label{tab2}
    \centering
    \makegapedcells
\begin{tabularx}{\linewidth}{@{} cc *{3}{L} @{} }
    \toprule
Work & Year & Blockchain Funcionality & Pros    & Cons      \\
    \midrule
\cite{song2019} & 2019 & Digital signature storage & Authenticated information & Centralized architecture \\
\cite{shang2018}& 2018 & Information storage & Scratch Information & Unauthenticated information \\
\cite{huckle}   & 2017 & Hash/metadata storage & Authenticated information & High cost \\
\makecell[t]{Our\\ Work}
                & 2019 & Algorithm processing & Reliability e Authenticity & None \\
    \bottomrule
\end{tabularx}
\end{table}
\end{document}

enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.