LaTex: Table cell contents branch Display/Line break

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.