Question: How can the text of a cell in the same row of a table be centered vertically? For example, the text is longer than the page range needs a branch display
Answer: (from smth)
Programme one:
\newcommand{\tabincell}[2]{\begin{tabular}{@{}#[email protected]{}} #2 \end{tabular}}
% and then use &\tabincell{c}{}& to wrap in the table automatically.
% such as this use
\begin{tabular}{|c|c|}
\hline
1 & the first line \ \
\hline
2 & \tabincell{c}{haha\\ Heihei\\zeze} \ \
\hline
\end{tabular}
Note: Easy to use, have tried, the following is an example, can be directly saved as. tex file compilation Run
\documentclass[a4paper,12pt]{article}
\USEPACKAGE{CJK}
\begin{document}
\begin{cjk*}{gbk}{song}
\newcommand{\tabincell}[2]{\begin{tabular}{@{}#[email protected]{}} #2 \end{tabular}}
% and then use &\tabincell{c}{}& to wrap in the table automatically.
% such as this use
\begin{tabular}{|c|c|}
\hline
1 & the first line \ \
\hline
2 & \tabincell{c}{haha\\ heihei\\zeze \\fgf \\asgr} \ \
\hline
\end{tabular}
\end{cjk*}
\end{document}
Scenario Two:
\usepackage{longtable}
% i am under Linux, Pdflatex Test did not succeed, ask for reason, beg explanation. (LIM)
Programme III: (If you think the contents of the cell, do not branch also line)
Use \resizebox{\textwidth}{!} {...}, use the Graphix macro package.
Reference: Latex, shrink table or Horizontal table
LaTex: Table cell contents branch Display/Line break