Latex processing table

Source: Internet
Author: User
In the paper writing, sometimes a table has a long horizontal span, but latex cannot automatically disconnect the content in the cell based on the page width, and the horizontal length of the table content cannot be displayed. There are four solutions: first, the simplest and most elementary method is to reduce the font of the content in the table. This kind of processing often cannot meet the requirements of some journals. Second, use P {width} in the table to limit the length of a column, for example, p {5 cm }. Third, change the table generation environment to the tabular * environment or the tabularx environment. Fourth, if the horizontal span of the table is indeed very long and the table is large, the best way to handle this is to rotate the table vertically and use the rotating macro package.

 

How does latex make the font sizes of different columns in the table different?

Http://bbs.sciencenet.cn/home.php? MoD = Space & uid = 111494 & Do = Blog & id = 436728

First, use the \ usepackage {array} macro package in preamble, and then define the fonts of different columns in the \ begin {tabular} environment. Note that before the content of each cell in the table is aligned, use> {Decl} to define the font size of each cell. Example: % how to change the font size of a table column? %

My living address in Canada is given in Table ~ \ Ref {address }.

\ Begin {table} [H]

\ Centering

\ Caption {This is my living address in Canada}

\ Label {address}

\ Begin {tabular }{|>{\ small} c |>{\ huge} c |}

\ Hline

Barclay Street & Hamilton \\

\ Hline

Ontario & Canada \\

\ Hline

\ End {tabular}

\ End {table}

 

Example of the table column width control command P {width} In Latex

Http://bbs.sciencenet.cn/home.php? MoD = Space & uid = 111494 & Do = Blog & id = 434507

If the horizontal content in the table is too long to display, you can use P {width} to control the column width as mentioned in the previous blog, here is an example of an application and the corresponding table creation code. % Without specifying width for last column % % \ begin {Center}

\ Begin {tabular} {| L |}

\ Hline

Item & name & Gender & habit & self-introd tion \ hline

1 & Jimmy & male & badminton & Hi, everyone, my name is Jimmy. I come from Hamilton,

And it's my great honor to give this example. My topic is about how to use P {width} command \ hline

2 & Jimmy & male & badminton & Hi, everyone, my name is Jimmy. I come from Hamilton,

And it's my great honor to give this example. My topic is about how to use P {width} command \ hline

3 & Jimmy & male & badminton & Hi, everyone, my name is Jimmy. I come from Hamilton,

And it's my great honor to give this example. My topic is about how to use P {width} command \\

\ Hline

\ End {tabular}

\ End {Center}

 

% With width specified for the last column %

\ Begin {Center}

\ Begin {tabular }{| L | P {5 cm} |}

\ Hline

Item & name & Gender & habit & self-introd tion \ hline

1 & Jimmy & male & badminton & Hi, everyone, my name is Jimmy. I come from Hamilton,

And it's my great honor to give this example. My topic is about how to use P {width} command \ hline

2 & Jimmy & male & badminton & Hi, everyone, my name is Jimmy. I come from Hamilton,

And it's my great honor to give this example. My topic is about how to use P {width} command \ hline

3 & Jimmy & male & badminton & Hi, everyone, my name is Jimmy. I come from Hamilton,

And it's my great honor to give this example. My topic is about how to use P {width} command \\

\ Hline

\ End {tabular}

\ End {Center}

Horizontal position conversion vertical position of latex table

Http://bbs.sciencenet.cn/home.php? MoD = Space & uid = 111494 & Do = Blog & id = 434772

To rotate a table in the layout of the page, add the \ usepackage {rotating} macro package to the preamble section, and then use the sidewaystable environment. example: % method 4: rotate the position of the Table Page to vertical arrangement %

\ Begin {sidewaystable}

\ Centering

\ Begin {tabular} {lllll}

\ Hline

Item 1 & item 2 & item 3 & item 4 & Item 5 \\

\ Hline

\ Multicolumn {5} {L} {\ BF s item 1 }\\

A & B & C & D & E \\

A & B & C & D & E \\

A & B & C & D & E \\

A & B & C & D & E \\

A & B & C & D & E \\

&&&&\\

\ Multicolumn {5} {L} {\ BF s item 2 }\\

A & B & C & D & E \\

A & B & C & D & E \\

A & B & C & D & E \\

A & B & C & D & E \\

A & B & C & D & E \\

\ Hline

\ End {tabular}

\ Caption {This is an example of rotate table layout} \ label {rotatetable}

\ End {sidewaystable}

 

Introduction to using latex to create complex tables in multirow, multicolum, and Cline

Http://bbs.sciencenet.cn/home.php? MoD = Space & uid = 111494 & Do = Blog & id = 445494

In complex table creation, if a column spans multiple rows or a row spans multiple columns, the \ multirow and \ multicolum commands are used separately. The standard syntax is as follows: \ multicolumn { Num_cols}{ Alignment}{ Contents}. % Num_colsIs the number of S seqnt columns to merge; AlignmentIs, either l, C, R or to have text wrapping specifiy a width P {5.0}. And ContentsIs simply the Act L data you want to be contained within that cell. % \ multirow { Num_rows}{ Width}{ Contents}. % The arguments are pretty simple to ded E (* for WidthMeans the content's natural width ). % (Note: This Command requires adding a macro package \ usepackage {multirow} in preamble). In addition, to draw a line from a column in a complex table, use the \ Cline command. The standard syntax is \ Cline { I- J} % Partial horizontal line beginning in Column IAnd ending in Column J %For details about \ multicolum and \ multirow during table creation, refer to the table section in latex document. Here, this blog post provides a more complex table creation, that is, the table exists across multiple rows and columns at the same time, this will show the mixed use of \ multicolum and \ multirow. (In this case, use \ multicolumn {1} {| C |}{...} to draw the left and right boundary lines of cells ). Example 1: \ usepackage {multirow}
\ Hline
\ Multicolumn {1} {C |}{\ multirow {2 }{* }{ Canada }}& \ multicolumn {1 }{| C |}{\ multirow {2 }{ *} {Ontario }}& \ multicolumn {2} {| c} {Hamilton }\\\ Cline {3-4}
\ Multicolumn {1} {C |}{}& \ multicolumn {1 }{| C }{}&
\ Multicolumn {1 }{| C |}{ Barclay Street} & Emerson Street \\
\ Hline
\ End {tabular}

Example 2:

\ Usepackage {multirow} ..................\ Begin {tabular} {CC | c | L}
\ Cline {3-6}
& Amp; \ multicolumn {4 }{| C |}{ Jimmy }\\\ Cline {3-6}
& Canada & China & Ontario & Hamilton \\\ Cline {1-6}
\ Multicolumn {1} {| C |}{\ multirow {2} {*} {McMaster }}&
\ Multicolumn {1 }{| C |}{ MS} & mon & T & Wed & Thu & degroote School of Business \ Cline {2-6}
\ Multicolumn {1 }{| C | }{}&
\ Multicolumn {1} {| C |}{ is} & Jan & Feb & Mar & APR & degroote School of Business \ Cline {1-6}
\ End {tabular} [convert] http://blog.163.com/heyanqiner@126/blog/static/173423558201152454357190/ ------- multirow Set width, line feed

 

For example, in Column 4th of the table, three rows are merged first, and then four rows are written into the content. How can we wrap the content of this cell?

 \begin{tabular}{p{2em}c} \hline%         a \newline b& \multirow{3}{8em}{soppurt ISO\\18000-6b\\Compactflash,\\SD slots}\\         b & \\         c& \\ \hline\end{tabular}

 

 

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.