I wanted to make a table with the text centered in every box of the table, both horizontally and vertically. This is my code:   \renewcommand{\arraystretch}{1.5} \begin{center}  \begin{tabular}{ |&gt;{\centering}p{0.5cm}|&gt;{\centering}p{0.5cm}|&gt;{\centering}p{0.5cm}|p{0.5cm}| } \hline A &amp; B &amp; C &amp; $\varphi$ \\ \hline \end{tabular} \end{center}   and this is the result:  (I removed the other 8 lines of the code, because they were basically the same)    And now the thing is, the fourth column isn't centered and when I put >{\centering} before p{0.5cm}, exactly how I did on the first 3 columns, Tex would give me     Any ideas how to fix this?  Thanks.
119015
I have a document that uses both the longtable and the array package. At first I ascribed the problem to an interaction of both. After testing, it seems array is the only culprit.  Here's a minimal example.  \documentclass{article} \usepackage{array} \begin{document}  \begin{tabular}{p{0.4\textwidth}&gt;{\raggedright}p{0.4\textwidth}} 1 &amp; a \\ 2 &amp; b \\ 3 &amp; c \\ \end{tabular} \end{document}   It produces the error  ! Extra alignment tab has been changed to \cr.
100316
I have the following problem. I want to center a listing, I tried this approach:   It works but when I try to set frame or numbers specifically for each listing I get errors. Here´s the M(Not)WE:  \documentclass{article} \usepackage[utf8]{inputenc} \usepackage{listings} \begin{document}  \begin{figure}[thp]  \begin{tabular}{c}   \begin{lstlisting}[numbers=left] % Here lies the problem without the numbers=left it works    My Code   \end{lstlisting}  \end{tabular}  \centering  \caption{Bla} \end{figure}  \end{document}   Is there another way to center the listings and captions or how could I fix this approach?
119213
I want to draw the following table in LaTeX. In the first column the text should be left aligned. The text in all other cells should be centered. The first problem occurs with D in the first row. If I write a \centering in front of D, I get a LaTeX error. The second problem is, that I want to vertically align the text in all cells but I don't know how. I have found a solution but it doesn't work if the width of the first column is specified.  \documentclass{article} \usepackage{blindtext} \usepackage{tabularx}  \begin{document}   \begin{tabularx}{\textwidth}{|p{4cm}|X|X|X|X|}     \hline                &amp; \centering A &amp; \centering B &amp; \centering C &amp; D\\     \hline     \blindtext &amp; 123 &amp; 123 &amp; 123 &amp; 123\\     \hline   \end{tabularx} \end{document}
89488
How to exactly make a rotated, multiple-row label (i.e., from) of a table vertically centered?  \documentclass[preview,border=12pt,12pt]{standalone} \usepackage{array,multirow,graphicx}  \begin{document} \begin{tabular}{|*5{c|}} \cline{3-5} \multicolumn{2}{c|}{\multirow{2}{*}{}} &amp; \multicolumn{3}{c|}{to}\\\cline{3-5} \multicolumn{2}{c|}{}                     &amp; a &amp; b &amp; c\\\hline \multirow{4}{*}{\rotatebox{90}{from}} &amp; 1 &amp; d &amp; e &amp; f\\\cline{2-5}                                       &amp; 2 &amp; g &amp; h &amp; i\\\cline{2-5}                                       &amp; 3 &amp; j &amp; k &amp; l\\\cline{2-5}                                       &amp; 4 &amp; m &amp; n &amp; o\\\hline \end{tabular} \end{document}
58161
With this MWE  \documentclass{article} \usepackage{tabulary}  \begin{document}  \hrule  \begin{center}   \begin{tabulary}{\textwidth}{|L|L|L|}     foo&amp;bar&amp;baz   \end{tabulary} \end{center}  \hrule  \end{document}   I get a table which is narrower than the page:   But I'd like the table to be spread out to \textwidth like tabularx would do. Is this possible?  Or is there an alternative approach?
40976
I need this table:    (each row and column should have the same height and length, last cell should be divided by diagonal line). I tried the following code:  \documentclass[11pt]{article} \usepackage[T1]{fontenc} \usepackage{array} \usepackage{makecell} \newcolumntype{x}[1]{&gt;{\centering\let\newline\\\arraybackslash\hspace{0pt}}p{#1}} \begin{document} \setlength{\extrarowheight}{0.1cm} \begin{tabular}{|x{0.5cm}|x{0.5cm}|x{0.5cm}|x{0.5cm}|x{0.5cm}|}\hline &amp;&amp;&amp;&amp;20\\ \hline &amp;&amp;&amp;&amp;30\\ \hline &amp;&amp;&amp;&amp;45\\ \hline 15&amp;12&amp;18&amp;50&amp;\diaghead(-3,2){\hskip \hsize}{$a_i$}{$b_j$}\\ \hline \end{tabular} \end{document}   but text in the last cell is displayed incorrectly and cells are not the same.     How can I change that?
54749
I want a table whose first column is aligned top, second column is aligned middle, and third column is aligned bottom; like this:    I wrote the following code:  \documentclass{article} \usepackage[english]{babel} \usepackage{array}  \begin{document}  \begin{tabular}{| p{1cm} | m{1cm} | b{1cm} |}     \hline     x &amp;     A long text comes here &amp;     x \\ \hline \end{tabular}  \end{document}   Yet, to my surprise, the outcome was "all columns aligned middle," as follows:    What did I do wrong?
112136
This picture is a part of a table i am using, the terms subcases are vertically written but i cant center them vertically also in the next columns terms like A, B, etc are also not vertically centered. I made this table using tabulary package a. My code is  \begin{table}[H]  \centering  \caption{Saturation Table}  \label{tab:5}%  \begin{tabulary}{1\linewidth}{J J J J J J J J J J J J J}  \toprule  &amp; \textbf{Method} &amp; \multicolumn{1}{c}{\textbf{Parameters}} &amp; \textbf{Step 0} &amp; \textbf{Step 1} &amp; \textbf{Step 2} &amp; \textbf{Step 3} &amp; \textbf{Step 4} &amp; \textbf{Step 5} &amp; \textbf{Step 6} &amp; \textbf{Step 7} &amp; \textbf{Step 8} &amp; \textbf{Step 9} \\  \midrule  \multirow{4}[4]{*}{\begin{sideways}\textbf{Subcase A}\end{sideways}} &amp;  \multirow{2}[2]{*}{\textbf{A}} &amp; \textbf{No} &amp; 1 &amp; 2 &amp; 3 &amp; 4 &amp; 5 &amp; \textbf{6} &amp; &amp; &amp; &amp; \\[1mm]  &amp; &amp; \textbf{Maximum Saturation {(\%)}} &amp; 1 &amp; 2 &amp; 3 &amp; 4 &amp; 4 &amp; \textbf{5} &amp; &amp; &amp; &amp; \\  \cmidrule{2-13} &amp; \multirow{2}[2]{*}{\textbf{B}} &amp; \textbf{No} &amp; 1 &amp; 2 &amp; 3 &amp; 4 &amp; 5 &amp; 6 &amp; 7 &amp; \textbf{8} &amp; &amp; \\[1mm]  &amp; &amp; \textbf{Maximum Saturation {(\%)}} &amp; 6 &amp; 6 &amp; 7 &amp; 8 &amp; 9 &amp; 9 &amp; 19 &amp; \textbf{8} &amp; &amp; \\  \bottomrule  \end{tabulary}%  \end{table}%
26668
I have a rather wide table for which I have a designated page in landscape mode. The rest of the document is in portrait mode. Currently, the first row of the table begins at the very top of the page and ends somewhere in the middle. I'd like the table to be vertically centered though. How can I achieve this? I'm using the tabular environment.
38528
I'm going crazy in trying to draw the following table in LaTeX:    Can you help me please? Thank you in advance  Here's what I've done:  \begin{tabular}{c c c}     A &amp; \multicolumn{2}{c}{B}\\ E &amp; F \\ C\\    D &amp; G\\   \end{tabular}   Thank you all, guys, but I have to draw a table just using the following packages: array, multirow, tabularx, and the supertabular.
96328
I have a LaTeX table generated like this,   \begin{table}[ht] \begin{center} \begin{tabular}{rrrrrrr} \hline &amp; 1 &amp; 2 &amp; 3 &amp; 4 &amp; 5 &amp; 6 \\  \hline 1 &amp; 181.21 &amp; 169.01 &amp; 130.03 &amp; 135.93 &amp; 142.31 &amp; 108.11 \\  2 &amp; 106.80 &amp; 130.71 &amp; 186.43 &amp; 126.46 &amp; 167.28 &amp; 137.91 \\  3 &amp; 162.69 &amp; 198.98 &amp; 188.33 &amp; 184.30 &amp; 147.02 &amp; 197.38 \\  4 &amp; 132.42 &amp; 150.50 &amp; 148.69 &amp; 134.31 &amp; 129.52 &amp; 172.72 \\  \hline \end{tabular} \end{center} \end{table}   but when i compile it in MiKTeX I am getting the following error   ! Undefined control sequence. l.1 \begin           {table}[ht] ?  Process interrupted by user   I want a table generated from this i am compiling under pdfTeX. I am using LaTeX for first time, can anyone please give a suggestion?
113523
I'm trying to write my thesis on LaTeX and I don't have much experience with it. I try to put an information about some arrays I used as a table one like looks like this: column names:  FileName, Strain, Replicate   for this I use this code:  \begin{tabular}  US45102998_251897210500_S01_GE1_107_Sep09_1_3.txt &amp; RAL765 &amp; 1 \  \end{tabular}   what latex thinks it is: US45102998251897210573S01GE1107Sep0911.txt It creates this line where the numbers after underscore are subscripts of the former text. I used \textdollar{} and it didn't work for me . I used \verb{}, and it worked (it didn't turn the text into a mathematical expression), but now I see } sign right after the text and it doesn't break the line.  the full code is:  \begin{center}  \tablehead{Array Information}  \toprule  \tableheadline {File Name} &amp; \tableheadline{Strain} &amp; \tableheadline{Replicate} \ \midrule  \hline}  \tabletail{\multicolumn{4}{r} {Continued on next page...} \}  \tablecaption{Array information}  \xentrystretch{0}  \begin{tabular}{llll{5 cm}}  \label{xtab: arrayinformation}  And at the end it is:  \hline  \end{xtabular}  \end{center}   Any suggestions? Note: I'm not so familiar with LaTeX lingo.
51207
I have a table table and the first column is a multirow. The multirow column text exceeds the column with.   \documentclass{article}  \usepackage[dutch]{babel} \usepackage{ragged2e} \usepackage{ltablex, multirow, makecell, caption}  \begin{document}  \keepXColumns\setcellgapes{3pt}\makegapedcells \begin{tabularx}{\linewidth}{|p{25mm}|*{3}{&gt;{\RaggedRight\arraybackslash}X|}}   \caption{My caption}   \label{my-label} \\    \hline  Onderwerp &amp; Persoonlijk niveau &amp; Professioneel niveau &amp; Samenlevingsniveau \\ \hline     \multirow{4}{*}{Perspectief: Wat is het hogere doel}      &amp; Wat is jouw hoge doel in het leven?  &amp; Wat is jouw hoge doel in je beroep? &amp;  Wat is jouw hoge doel in de samenleving? \\ \cline{2-4}     &amp; &amp; &amp; x \\ \cline{2-4}   \hline  \end{tabularx}  \end{document}     How can I make the text wrap and go to next line when the line is longer then the column width like the other columns?
118673
Are we able to make centre for header and left side for content in a table?  For Testing 1 species, Class AA), is centre and good. For 18, 17, 15, 18 and 18,17, 18 and 18,17, can we move to left side?  I am using table-number-alignment=center for all.    My MWE:  \documentclass[12pt,oneside]{book}  \usepackage[showframe]{geometry} \usepackage{amsmath} \usepackage{ragged2e} \usepackage{makecell, multirow, tabularx} \renewcommand\theadfont{\small\bfseries} % for bold in table using \small \renewcommand\theadgape{} \usepackage[svgnames, table]{xcolor} \usepackage{hhline, boldline} \usepackage{seqsplit, caption} %for table spacing to second row \usepackage{booktabs, ragged2e} % Use booktabs rules and get rid of vertical rules, ragged2e to ragged text \usepackage{siunitx} %for table spacing to second row \usepackage{threeparttable} %to add footnote below table \usepackage{tabulary} \usepackage{graphicx}  \usepackage[font=small,labelfont={bf,sf}, textfont={sf}, justification=centering]{caption}  \begin{document}   \begin{table}[h!] \centering \sisetup{table-format=6.0, table-number-alignment=center, table-column-width=6.0cm}  \begin{tabular}{lcc}      \toprule       &amp; \multicolumn{2}{c}{\thead{Sample Number}}\\       \cmidrule{2-3}      &amp; \thead{Testing1 species \\(Class AA)}      &amp; \thead{Testing2 species \\ (Class BB)} \\      \midrule     High Wavenlength &amp; {18, 17, 15, 18} &amp; {19, 18, 1, 11} \\     Medium Wavenlength &amp; {18, 17, 18} &amp; {19, 18, 11} \\     Low Wavenlength &amp; {18, 17} &amp; {19, 18} \\      \bottomrule     \end{tabular} \end{table}   \end{document}
84421
I'm trying to create a multi-page table with all cells having the same height (as well as certain fixed widths) so that certain manual cut-and-paste operations are a lot easier.  One issue is that one column in particular is text-heavy and should line-break within the cell.  As I don't want it justified, I looked into alternatives such as .  This is doing exactly what I want for horizontal alignment.  For vertical alignment, I've looked at  and the \vphantom method detailed in the above link doesn't seem to be working.  Here's what I'm currently working with:  \documentclass[11pt]{article} \usepackage{array}  \newcolumntype{P}[1]{&gt;{\raggedright\hspace{0pt}\arraybackslash}p{#1}} \def\Z{\vphantom{\parbox[c]{1.7in}{\Huge Something Long}}}  \begin{document} \begin{tabular}{| c || P{0.5in} || P{0.5in} || P{5in} |}\hline  1.  \Z &amp;&amp;&amp; Long long long long long long long long long             long long long long long long long text  \\\hline 2.  \Z &amp;&amp;&amp; More long long long long long long long long             long long long long long long long text  \\\hline \end{tabular}   When I compile, the cells do not have a uniform height, and none of them are as large as 1.7 inches vertically.  So this suggests that somehow the \vphantom method is failing.  Does anybody know of a relatively straightforward solution to this problem?
40889
So I have this table, which I just used an online tool to create, but I want the columns to wrap. So, I just change \begin{tabular} to \begin{tabularx} and then the last column vertical line is about 1cm from the table... How can I fix that gap? \begin{tabularx}{\textwidth}{|X|X|X|X|} \hline Name:                                      &amp; Donald Trump                              &amp; Student ID:                                         &amp; 99999999                                     \\ \hline \multicolumn{2}{|p{0.5\textwidth}|}{Feedback focus:}                                                 &amp; \multicolumn{2}{p{0.5\textwidth}|}{asoidjfaopsidjfp oiajdfpo iasjdfp oiasjdfpo ij}                                \\ \hline \multicolumn{2}{|p{0.5\textwidth}|}{askdljf ;laksjdf;l aksjdf;lkajsd;:}                          &amp; \multicolumn{2}{l|}{as;ldifja;lsdkfja;lsdkfja; slkfj; aldkjf ;aslkdj ;alk}                         \\ \hline \hline \multicolumn{4}{|p{\textwidth}|}{as;ldkf;lkj: aklsduhf asldkj f;alskdjf ;alskdjf ;alskdf }                                                                  \\ \hline Fully Met                                  &amp; Met                                      &amp; Partially Met                                       &amp; Not Met                                      \\ \hline Comments:                                  &amp; \multicolumn{3}{l|}{}                                                                                                                         \\ \hline \multicolumn{4}{|p{\textwidth}|}{asldkjf;alksdj f;laksjdf:as;dlk ja;lsdk fjas;ldkfj a;slkdfj ;lakasdlk;jkdj }                                                                               \\ \hline Fully Met                                  &amp; Met                                      &amp; Partially Met                                       &amp; Not Met                                      \\ \hline Comments:                                  &amp; \multicolumn{3}{l|}{}                                                                                                                         \\ \hline \multicolumn{4}{|p{\textwidth}|}{a;lsdkjf; lakj;l3: alkjdsf l;aksjdf;l kasjd;lf kjasd;l fkjas;ldkfjas;ldkf jas;ldkf ja;sldkfj asldkfj alksjferopijp34qjp asdf} \\ \hline Fully Met                                  &amp; Met                                      &amp; Partially Met                                       &amp; Not Met                                      \\ \hline Comments:                                  &amp; \multicolumn{3}{l|}{}                                                                                                                         \\ \hline \multicolumn{4}{|p{\textwidth}|}{as;ldkfjal;kej ;l4: alskdjf ;lasdkjf ;alskdjf ;laskd}                                                                                                                      \\ \hline Fully Met                                  &amp; Met                                      &amp; Partially Met                                       &amp; Not Met                                      \\ \hline Comments:                                  &amp; \multicolumn{3}{l|}{}                                                                                                                         \\ \hline \multicolumn{4}{|p{\textwidth}|}{asl;dkjf;lk4j: asl;dkjfaslkdjf eirkajp (asl;dkfj a) aslkdjf l}                                                                                             \\ \hline Fully Met                                  &amp; Met                                      &amp; Partially Met                                       &amp; Not Met                                      \\ \hline Comments:                                  &amp; \multicolumn{3}{l|}{}                                                                                                                         \\ \hline \end{tabularx}  Gives:
57287
I am trying to make a LaTeX table that includes special headers. My code for the table is shown below: \begin{table}[ht] \centering \scalebox{0.70}{ \begin{tabular}{lddcdd} \toprule  &amp;\multicolumn{2}{c}{M1} &amp;   &amp; \multicolumn{2}{c}{M2} \\ \cmidrule{2-3} \cmidrule{5-6}  &amp; \multicolumn{1}{c}{1-2}   &amp; \multicolumn{1}{c}{7-8} &amp;   &amp; \multicolumn{1}{c}{1-2}   &amp; \multicolumn{1}{c}{7-8} \\  \midrule A &amp;   \textbf{0.0021} &amp; \textbf{0.0033} &amp; &amp; -2.37 &amp; 0.00 \\  B &amp; \textbf{0.0052} &amp; \textbf{0.0042} &amp; &amp; -1.23 &amp; 0.67 \\  C &amp; \textbf{0.0082} &amp; \textbf{0.0057} &amp; &amp; -0.21 &amp; 1.08 \\  D &amp; 0.0107 &amp; 0.0097 &amp; &amp;  0.74 &amp; 1.41 \\  E &amp; \textbf{0.0080} &amp; 0.0088 &amp; &amp;  5.05 &amp; 5.05 \\  F &amp; 0.0140 &amp; 0.0148 &amp; &amp; -2.37 &amp; 0.00 \\  G &amp; 0.0128 &amp; 0.0176 &amp; &amp; -1.23 &amp; 0.67 \\  H &amp; 0.0157 &amp; 0.0164 &amp; &amp; -0.62 &amp; 1.10 \\  I &amp; 0.0145 &amp; 0.0155 &amp; &amp; -0.21 &amp; 1.08 \\  K &amp; 0.0236 &amp; 0.0225 &amp; &amp;  5.05 &amp; 5.05 \\  \bottomrule \end{tabular}} \smallskip \caption{My Caption} \label{tab:table1} \end{table}  it creates a table like this:  but I want the bolded numbers to align nicely with un-bolded numbers...How can I make the bolded numbers to align the other numbers in the right way? Thank you,