I am using the table environment in report class. Here is the MWE:  \documentclass{report} \begin{document} \begin{table} \begin{tabular}{cc} \hline a&amp;b\\ c&amp;d\\ \hline \end{tabular} \caption{Table name} \end{table} \end{document}   The output I am getting is a table with that is left aligned and a caption that is centred. If I use \centering I can get the table centred. However, I need to set each table separately in the table environment.  Which command I need to modify it so that all tables are centred?
51353
Background  Would like to center all tables within floats, without having to add \centering to each table.  Ideas  Tried the following:  \let\originaltabular\tabular \renewcommand\tabular{\centering\originaltabular}   It compiles, but the tables remain left-justified.  Question  How would you edit the Preamble of a LyX document to make all the floating tables be centred?
50042
I want to reverse (flip horizontal) all columns in some tables like this:  \documentclass{book}‎ ‎\begin{document}‎ \begin{center}‎ ‎\begin{tabular}{c|c|c}‎ ‎$p$ &amp; $q$ &amp; $p\vee q$ \\ \hline‎ ‎$T$ &amp; $T$ &amp;T\\‎ ‎$T$ &amp; $F$ &amp;T\\‎ ‎$F$ &amp; $T$ &amp;T\\‎ ‎$F$ &amp; $F$ &amp;F‎   ‎\end{tabular}‎ ‎\end{center}‎ ‎\end{document}   I wrote these tables in Persian Xe-TeX and this language is a right to left writing language, and these tables appear reverse in output, so I used \lr command but the tables broke down and went out from centering also. I don't want to rewrite them. How can I fix it?
116669
Is there a way to add the usage of a table/reference in the caption of the reference/table in LaTeX?  For example:  \begin{table}     \begin{tabular}{ll}     \textbf{Name} &amp; \textbf{Description} \\         Foo &amp; bar \\         Foo &amp; bar     \end{tabular}     \caption{Nice Table. Used on pages [2,3,4].}     \label{tab:table} \end{table}   I would like the "Used on pages[2,3,4]." to appear automatically and linked to the correct reference, to all the locations in the document that use \ref{tab:table}.  Anyone knows a package that takes care of this?
41703
I have the following code that produces the table that is shown. What I am trying to do is to get the fourth and fifth column titles vertically aligned at the top. Is this possible?  \documentclass{article} \usepackage{multirow} \usepackage{array}  \newcolumntype{x}[1]{% &gt;{\raggedright\hspace{0pt}}p{#1}}%  \begin{document} \centering \renewcommand{\arraystretch}{1.2} \begin{tabular}{| m{2cm} | p{2cm} | p{2cm} | p{2cm} | p{2cm} | p{2cm} |} \hline     \multirow{3}{1.7cm}{Data Set} &amp;%     \multicolumn{3}{c |}{Raw Data} &amp;%     Offline Processing Time &amp;     Index Size (KB)\\ \cline{2-4} %     &amp; %     RDF N3 File SizeKB (sec)    &amp;%     Number of Triples &amp;%     Number of Entities\\    \hline \end{tabular} \end{document}
113645
I'm trying to choose the positions of my tables but I can't figure out the difference between [H] and [h]. I've seen both advised over my search. If I use [h] the row spacing is different than [H] use.
45029
I would like to create a table with some columns' width specified, while the text in those columns should be centered both horizontally and vertically. I found out that  \usepackage{array} \begin{tabular}{| c | c | m{5cm} |}   vertically centers the text in the last column, but justifies it horizontally (like text in normal paragraphs).  Update: With Jake's method, it seems both \\ and \hline cause an error. How to fix it?
90950
I want to define a new command \tableheadline that (1) formats the headline text in some way and (2) takes an optional argument for spanning multiple columns while centering the headline.  I tried the following implementation:  \documentclass{minimal}  \newcommand{\tableheadline}[2][1]{\multicolumn{#1}{c}{\textit{#2}}} % \newcommand{\tableheadline}[2][1]{\multicolumn{1}{c}{\textit{#2}}}  \begin{document}   \begin{tabular}[\textwidth]{cc}      \tableheadline[2]{C}     \tableheadline{A} &amp; \tableheadline{B} \\     0 &amp; 1 \\     2 &amp; 3 \\   \end{tabular} \end{document}   This, however, gives me an error:  ! Misplaced \omit. \multispan -&gt;\omit                    \@multispan l.8 \tableheadline[2]{C}   I also get the error when I do not even use the optional argument (see commented line in the MWE). Any ideas what I am doing wrong?
103708
I'm getting some odd table alignment issues with a table that I'm constructing inside of a \whileboolexpr.  The .tex file is the following:  \documentclass{article}  \usepackage{etoolbox}  \newcounter{pcnt} \setcounter{pcnt}{0}  \newenvironment{defineperson}[1] {\csgdef{person\thepcnt}{#1}} {\stepcounter{pcnt}}  \newcommand\persontitle[1]{\csgdef{persontitle\thepcnt}{#1}} \newcommand\personmail[1]{\csgdef{personmail\thepcnt}{#1}} \newcommand\showperson[1]{\textbf{#1}}  \newcommand\maketabular[1]{\begin{tabular}{| l | l | l |} \hline #1 \end{tabular}}  \newcounter{nada}  \newcommand\makepersonrtable{%   \setcounter{nada}{0}%   \maketabular{%   \whileboolexpr     { test {\ifnumcomp{\value{nada}}{&lt;}{\value{pcnt}}} }%     {\showperson{\csuse{person\thenada}} &amp; \csuse{persontitle\thenada} &amp; \csuse{personmail\thenada} \\ \hline \stepcounter{nada} }   }}  \begin{defineperson}{Mr.}   \persontitle{Wall Eye}   \personmail{weye@gmail.com} \end{defineperson}  \begin{defineperson}{Mrs.}   \persontitle{Perch}   \personmail{perch@gmail.com} \end{defineperson}  \begin{defineperson}{Mr.}   \persontitle{Brook Trout}   \personmail{btrout@gmail.com} \end{defineperson}  \begin{document}  \makepersonrtable  \end{document}   This does generate a table as I would have expected, but the alignment is off - e.g.,   Notice that the first "Mr." is not aligned with the second row.  Also notice the extra vertical lines at the bottom.  Any idea what's going on here? I know there are other ways of making tables, but this I'm trying a few alternatives as a learning exercise.
110876
I've created the following table:  \begin{table}[htb] \centering \begin{tabular}{cc|c|c|c|c|} \cline{3-6} &amp;                                          &amp; \cellcolor[HTML]{3166FF}{\color[HTML]{FFFFFF} Col1 }  &amp; \cellcolor[HTML]{3166FF}{\color[HTML]{FFFFFF} Col2 }  &amp; \cellcolor[HTML]{3166FF}{\color[HTML]{FFFFFF} Col3 }  &amp; \cellcolor[HTML]{3166FF}{\color[HTML]{FFFFFF} Col4 }  \\ \hline \rowcolor[HTML]{FFFFFF}  \multicolumn{1}{|c|} {\cellcolor[HTML]{3166FF}{\color[HTML]{FFFFFF} }}                        &amp; sub-row-1                    &amp; -                                                        &amp; -                                                         &amp; -                                                      &amp; -                                                               \\ \cline{2-6}  \rowcolor[HTML]{CEE3FF}  \multicolumn{1}{|c|} {\multirow{-2}{*}{\cellcolor[HTML]{3166FF} {\color[HTML]{FFFFFF} row-1}}}  &amp;  {\color[HTML]{000000} sub-row-2} &amp;  {\color[HTML]{000000} -}                                &amp;  {\color[HTML]{000000} -}                                 &amp;  {\color[HTML]{000000} -}                              &amp;  {\color[HTML]{000000} -}                                        \\ \hline  \end{tabular} \caption{} \label{} \end{table}  As you can see from the picture below, when I compile the document in PDF, in the cell &quot;row-1&quot; there is a white row due to the merge of two cells.  How can i remove this line? The command that I'm using to compile the document is: pdflatex &lt;document_name&gt;  Thank you in advance
72854
I am trying to align the columns of multiple tables.  I know I can use p column format to fix column widths but I would prefer that TeX automatically figure out the widths for me.  I was hoping to:    output one table with all rows of each subsequent table so that the column widths of the combined table would be automatically good for all the subsequent tables  then output each subsequent table using the same settings and  figure out some way in which the first combined table could be generated but not visible.   Here is my attempt.  The first combined table uses \savetabu to save the settings and then each subsequent table uses \usetabu to retrieve them.  Unfortunately this does not work as I had hoped.  The columns do not line up as the output below (after the code) shows. Does anyone have a method of accomplishing this?  \documentclass{article}  \usepackage{tabu} \begin{document}  Output both tables together as one table and then output each individual table.  We had hoped that this would cause the subsequent tables to be the same width as the first since the first contains all columns of the subsequent tables but it seems that that does not work.  \begin{center} \begin{tabu}{ll}\savetabu{mytabu2} 1 &amp; 2 \\ 3 &amp; 4 \\ abcdefghijklmnopqrstuvwxyz &amp; 10 \\ 5 &amp; 6 \\ \end{tabu} \end{center}  \begin{center} \begin{tabu}{\usetabu{mytabu2}} 1 &amp; 2 \\ 3 &amp; 4 \\ \end{tabu} \end{center}  \begin{center} \begin{tabu}{\usetabu{mytabu2}} abcdefghijklmnopqrstuvwxyz &amp; 10 \\ 5 &amp; 6 \\ \end{tabu} \end{center}  \end{document}   Here is the output:
37406
I'm using estout (esttab actually) to produce a table in Latex from Stata. I'm using the dcolumn package to align the decimal places in my table.   I want to override the alignment for a single row; to be specific the number of observations row. Is there a way of doing this? Or, equivalents, if there a way to prefix each element in a row with "\multicolumn{1}{c}{" and suffix with "}", which would override the dcolumn alignment?  Example:  \begin{table}[htbp]\centering \caption{My Table} \begin{tabular}{l*{3}{D{.}{.}{-1}}} \toprule                             &amp;\multicolumn{1}{c}{Mean/s.d.}&amp;\multicolumn{1}{c}{Mean/s.d.}&amp;\multicolumn{1}{c}{Mean/s.d.}\\ \midrule Var A               &amp;        8.68&amp;        8.51&amp;        8.92\\                     &amp;        2.42&amp;        2.51&amp;        2.26\\ Var B               &amp;        2.14&amp;        1.98&amp;        2.37\\                     &amp;        1.33&amp;        1.29&amp;        1.35\\ \midrule Observations        &amp;       38040&amp;       22054&amp;       15986\\ \bottomrule \end{tabular} \end{table}   Thanks!
66743
I would like to have a table that looks like the image below.  \documentclass{article} \begin{document}     \begin{table*}         \begin{tabular}{|l|l|l|l|l|l|l|} \hline              &amp;\multicolumn{3}{c|}{A} &amp;\multicolumn{3}{c|}{B} \\ \cline{2-7}            1 &amp; a &amp; b &amp; c &amp; d &amp; e &amp; f \\ \hline           2 &amp; g &amp; h &amp; i &amp; j &amp; k &amp; l \\ \hline          \end{tabular}     \end{table*} \end{document}   However, I cannot obtain the table with an entire empty row, like the cold cache, written in its center. Is there some way to do so?    I also want the caption below the table.
32384
My table is going out of the page. Please give me a solution?  \begin{table}[] \centering \caption{My caption} \label{my-label} \begin{tabular}{|l|l|l|l|l|l|l|l|l|l|} \hline Ref      &amp; \multicolumn{6}{l|}{Model Used}        &amp; Approach                                   &amp; Limitation                                                                                                       &amp; Goal                                                                                                             \\ \hline          &amp; MBTI &amp; FFM &amp; BFI &amp; KTS &amp; BTR &amp; NEO-FFI &amp; \multicolumn{3}{l|}{}                                                                                                                                                                                                                                                            \\ \hline {[}10{]} &amp;      &amp;     &amp;     &amp;     &amp;     &amp;         &amp; Interactive personality profiling appraoch &amp; \begin{tabular}[c]{@{}l@{}}Test were based on subjective evidences which\\ may lead to uncertainty.\end{tabular} &amp; \begin{tabular}[c]{@{}l@{}}In order to propose a structure for effective\\ software team structure.\end{tabular} \\ \hline          &amp;      &amp;     &amp;     &amp;     &amp;     &amp;         &amp;                                            &amp;                                                                                                                  &amp;                                                                                                                  \\ \hline \end{tabular} \end{table}
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}
100885
\begin{table}[ht] \centering \begin{tabular}{c|ccccccc} \hline &amp; col1 &amp; col2 &amp; col3 &amp; col4 &amp; col5 &amp; col6 &amp; col7 \\ \hline \rowcolor{red} row1&amp; \ra &amp; \ra &amp; \ra &amp; \ra &amp; \ra &amp; \ra &amp; \ra \\ row2&amp; \ra &amp; \ra &amp; \ra &amp; \ra &amp; \ra &amp; \ra &amp; \ra \\ \rowcolor{red} row3&amp; \ra &amp; \ra &amp; \ra &amp; \ra &amp; \ra &amp; \ra &amp; \ra \\ row4&amp; \ra &amp; \ra &amp; \ra &amp; \ra &amp; \ra &amp; \ra &amp; \ra \\ \rowcolor{red} row5&amp; \ra &amp; \ra &amp; \ra &amp; \ra &amp; \ra &amp; \ra &amp; \ra \\ row6&amp; \ra &amp; \ra &amp; \ra &amp; \ra &amp; \ra &amp; \ra &amp; \ra \\ \hline \end{tabular} \end{table}   I have a simple table with color coded rows (red or black), and I would like to append a simple color coded legend that tells the reader Red = Male, Black = Female. Perhaps something that looks like this?
22401
This is similar to:  and , but is slightly different. The other questions are asking more of a why question, not a please do this question. I am asking for a specific implementation of Markdown tables. I found  on making tables in Markdown using  or . The code to make a table looks like this:  | Left align | Right align | Center align | |:-----------|------------:|:------------:| | This       |        This |     This     | | column     |      column |    column    | | will       |        will |     will     | | be         |          be |      be      | | left       |       right |    center    | | aligned    |     aligned |   aligned    |   And the result is:   This is much different than , which says that Jeff doesn't want the &lt;tr&gt;&lt;td&gt; tags allowed on the SE sites. This request has a specific feature request, as opposed to the other questions which don't really have a decisive yes/no answer.  Here are some specific posts that need this type of support:
100443
How can the auto-numbering on table captions be suppressed? For example, I have a table:  \section{Data} \begin{table}[h] \setlength{\arrayrulewidth}{1.5px} \centering \begin{tabular}{lcccc} \bottomrule  \bottomrule \end{tabular} \caption{This is my caption.} \end{table}   I just want the caption to read This is my caption. However, when I compile this code into a PDF file my table is automatically named Table 1. This is my caption. I've tried using \caption*, to suppress the auto-generated Table 1., but this does not solve my problem. Can anyone help?