Why is it so? My MWE:  \documentclass{article}  \usepackage{tabularx} \usepackage[table]{xcolor}  \begin{document}  \begin{table}[H]     \caption{Title.}\label{title}     \begin{tabularx}{\linewidth}{|p{5.5cm}|X|}     \hline     \color{red}{\textbf{Column 1}} &amp; \color{red}{\textbf{Column 2}} \\     \hline     A &amp; a \\     \hline       B &amp; b \\     \hline       C &amp; c \\         \hline       \end{tabularx} \end{table}  \end{document}   The result is as follows    If color is black, then the height is as I expect:
122385
I'm trying to make a beamer slide containing a table with the text in a row styled in a different color. However, the row's height increases when colored, as opposed to the default. The same problem occurs if I use the \rowfont command. How do I correct this?   \PassOptionsToPackage{table}{xcolor} \documentclass[compress]{beamer}  \begin{document} \begin{frame}     Example 1     \rowcolors{1}{gray!30}{blue!30}     \begin{tabular}{|p{0.5\textwidth}|}         \hline         \color{blue}{Foo} \\         Bar\\         Baz\\         \hline     \end{tabular}\\[1in]      Example 2     \rowcolors{1}{gray!30}{blue!30}     \begin{tabular}{|p{0.5\textwidth}|}         \hline         Foo \\         Bar\\         Baz\\         \hline     \end{tabular} \end{frame} \end{document}     I want the table to look like "Example 2", but with the row text colored as in "Example 1".
640
how to make some border lines of a table thick and colored (either vertical lines or horizental lines)?I tried Xcline but could not color it. Also I tried make the cline thick but failed.
13247
The tabular environment does not add any vertical space before or after it. This looks odd, in my view. What is the "correct" or "best" way to add some space? Also, why is there more space after the tabular environment than before it, as seen in the example below?  \documentclass{article} \begin{document} \noindent Here is a line with some text in it.  \begin{tabular}{*4{l}}     Worg &amp; Worg &amp; Worg &amp; Worg\\     Worg &amp; Worg &amp; Worg &amp; Worg\\ \end{tabular}  \noindent Here is another line with some text in it. \end{document}
116035
\documentclass{article} \usepackage[utf8]{inputenc} \usepackage{xcolor} \usepackage{minted} \usepackage{parskip}  \definecolor{codegray}{gray}{0.9} \newcommand{\code}[1]{\colorbox{codegray}{\texttt{#1}}}  \begin{document}  \code{test code}\\ anotherline  \end{document}   This is working good on sharelatex.com and looks like I expect and want it:   but on my local project using this command gives me this:   any idea what could be causing this colorbox height going to the next line?
40040
I'm trying to create the following table. This is the code which I wrote.   \begin{table}[!htb] \centering \caption{"table1"} \begin{tabular}{|c|c|c|c|c|c|c|c|} System &amp; \multicolumn{2}{c}{Interaction} &amp; \multicolumn{2}{c}{Commit} &amp; Ver &amp; LOC &amp; terms \\\hline \multirow{3}{c}{System1} &amp; \multicolumn{2}{c}{3272 traces} &amp; \multicolumn{2}{c}{5093 revisions} &amp; \multirow{3}{c}{3.4} &amp; \multirow{3}{c}{1700} &amp; \multirow{3}{c}{2400} \\\hline &amp; File &amp; Method &amp; File &amp; Method &amp; &amp; &amp; \\\hline &amp; 12 &amp; 13 &amp; 14 &amp; 15 &amp; &amp; &amp; \\\hline  \end{tabular} \end{table}   and this the error that Latex shows:! Missing number, treated as zero.!
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?
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.
38137
How can I center the column when using X in tabularx environment like in this example?  \begin{tabularx}{\textwidth}{@{}lXXXXX@{}}  1 &amp; 2 &amp; 3 &amp; 4 &amp; 5 \\    \end{tabularx}
74991
When I change the background color of a cell in a table, the color covers the borders, however I want the horizontal lines to remain.  I have a simple command \cellcolor[gray]{0.9} in my table. Can anybody help me with this problem?
121259
I have the following table:  \begin{tabular}{|p{3cm}|p{1.5cm}|p{1.5cm}|p{1.5cm}|p{1.5cm}|} \hline \centerline {image}  &amp;    \multicolumn{2}{c|}{ABC} &amp; \multicolumn{2}{c|}{DEF} \\ \hline  &amp; \centering A&amp;\centering B&amp;\centering C&amp;\centering D  \\ \hline \centerline 1&amp;&amp;&amp;&amp; \\ \hline \centerline 1&amp;&amp;&amp;&amp; \\ \hline \centerline 1&amp;&amp;&amp;&amp; \\ \hline \centerline 1&amp;&amp;&amp;&amp; \\ \hline \end{tabular}   When I try centering D, I have a problem in the shape of the table. Why is that? How can I center it appropriately?  Thanks.
100054
How to adapt this table to break across page boundaries?  Original question here:      \documentclass{article}     \usepackage{tabularx}     \usepackage{amsmath}     \usepackage[table]{xcolor}     \usepackage{tabularx, multirow, makecell, rotating} %     \usepackage{enumitem}          \begin{document}         \begin{center}     \bfseries \settowidth\rotheadsize{List of Abbreviation/accronym} \begin{tabularx}{\linewidth}{|c|&gt;{\centering\arraybackslash}X|}     \hline \cellcolor{gray!30} Abbreviation &amp; \cellcolor{gray!30} Explanation     \\     \hline \multirow[b]{2}{*}{USA}                &amp; \cellcolor{blue!30}  United state of america  \rule[-1em]{0pt}{2.5em} \\     \cline{2-2} %   &amp;  %   \rule[-1em]{0pt}{2.5em} \\ %    \cline{2-2}     &amp;    \rule[-1em]{0pt}{2.5em} \\     \hline         \multirow[b]{2}{*}{NY}                &amp;  \cellcolor{blue!30} New york   \rule[-1em]{0pt}{2.5em} \\     \cline{2-2} %   &amp;  %   \rule[-1em]{0pt}{2.5em} \\ %    \cline{2-2}     &amp;     \rule[-1em]{0pt}{2.5em} \\     \hline \end{tabularx}     \end{center}     \end{document}
73595
After posting  to the query , I thought about how to generalize (and simplify) the OP's setting, e.g., by using explicit theorem-like environments in the two columns.   In the following MWE, which employs the tabularx and amsthm packages, things work fine. (The framelines in the screenshot indicate the edges of the text block.) In the first tabularx environment, the first column is narrower than the second, and in the second tabularx environment, the situation is reversed. In both environments, the filler text that makes up the body of the "theorems" occupies the full width of the cell:    \documentclass{article} \usepackage[a4paper,margin=2.5cm,showframe]{geometry} \usepackage{tabularx} \newcolumntype{L}[1]{&gt;{\hsize=#1\hsize}X} \usepackage{lipsum}  \usepackage{amsthm}  %\usepackage{ntheorem}  \newtheorem{theorem}{Theorem}  \begin{document} \noindent % First column is narrower than second: \begin{tabularx}{\textwidth}{@{} L{0.8} | L{1.2} @{}}   \begin{theorem} \lipsum*[2] \end{theorem} &amp;   \begin{theorem} \lipsum*[2] \end{theorem} \end{tabularx}  \bigskip\noindent % Now, first column is wider: \begin{tabularx}{\textwidth}{@{} L{1.2} | L{0.8} @{}}   \begin{theorem} \lipsum*[2] \end{theorem} &amp;   \begin{theorem} \lipsum*[2] \end{theorem} \end{tabularx} \end{document}     However, if I comment out the instruction \usepackage{amsthm} and activate the instruction \usepackage{ntheorem} in the preceding MWE (and leave everything else unchanged), I get a rather different result: In the first tabularx environment, the text in the right-hand cell does not occupy the available horizontal space; in the second tabularx environment, both columns now take up the same width even as the width of the text in both cells is restricted to that of the second column.  Question: Have I encountered a bug in either ntheorem or tabularx, or did I set up the mechanism for generating X columns of varying widths incorrectly?  Some background information: The issue occurs with both TeXLive2019 and the current pre-release version of TeXLive2020. I use tabularx 2020/01/15 v2.11c, amsthm 2017/10/31 v2.20.4, and ntheorem Version 1.33 &lt;2011/08/15&gt;. AFAICT, the issue appears to be independent of the choice of document class.
108696
I notice that the space between each column of a table in LaTeX is not quite wide (at least for me). Is there any way to set this? I found the \hspace, but I don't get how to use this in the table.
124174
I am trying to create a graph in Latex with the given code:  \begin{table}[htbp]   \centering   \caption{Table showing the processed data.}     \scalebox{0.7}{     \begin{tabular}{|c|c|c|c|}     \hline     \multicolumn{1}{l}{Average distance, x/ $\SI{}{cm}$} &amp; \multicolumn{1}{l}{Uncertainty in average distance/ $\pm \SI{}{cm}$} &amp; \multicolumn{1}{l}{Average distance squared/ $\SI{}{cm^2}$} &amp; \multicolumn{1}{l}{Uncertainty in average distance squared / $\pm \SI{}{cm^2}$} \\     \hline     18.2  &amp; 0.3   &amp; 332   &amp; 10.9 \\     24.4  &amp; 0.5   &amp; 597   &amp; 24.4 \\     28.0  &amp; 0.6   &amp; 786   &amp; 33.6 \\     35.7  &amp; 0.8   &amp; 1280  &amp; 57.2 \\     38.6  &amp; 0.5   &amp; 1490  &amp; 38.6 \\     45.2  &amp; 0.5   &amp; 2050 &amp; 45.2 \\     49.1  &amp; 1.1   &amp; 2410 &amp; 103.1 \\     56.5  &amp; 1.2   &amp; 3190 &amp; 130.0 \\     59.7  &amp; 1.2   &amp; 3560 &amp; 143.2 \\     61.1  &amp; 3.6   &amp; 3730 &amp; 433.8 \\     63.3  &amp; 1.0   &amp; 4000 &amp; 120.2 \\     \hline     \end{tabular}     }   \label{tab:addlabel}% \end{table}%   But when I compile, the table looks very uneven:   What is causing the table to align itself in this way and how can I fix this issue?  Thanks, Aidanaidan12
9934
How do you guys go about controlling column padding in tables?   Update  To clarify, I'm looking for a way to control both vertical and horizontal padding. So, if I had a simple table like in the following code snippet, I could pad the columns and make them look a bit less... ugly. :P   \begin{tabular}{|l|l|}     \hline     column 1 &amp; column 2 \\      \hline     I really would like this less &amp; crammed\\     \hline \end{tabular}   I tried this by using the command \vspace but it leaves gaps in the vertical lines.
114416
Whenever I use the colortbl package to format tables, a thin white space between the cells sometimes shows up on screen (not in print for as far as I can tell). For example in this table:    Is there an easy way to enlarge each rectangle by a tiny amount so that the white space is not visible anymore?  (My guess is that the white space appears due to rounding in my pdf viewer, evince. I don't know if other pdf viewers have the same issue. Regardless, I would like to have my pdf file look good in common pdf readers)
6125
I'm trying to typeset a table that would have a header in the first row (I'm not looking for a different/better solution to adding a header, but for a fix to this solution. Thanks). I want to achieve this by having a multicolumn cell spanning all the columns of the first row. The problem is that if the text is too long, the column widths are uneven, with the last column accumulating excess width. I would expect all of the columns to be of approximately the same width (although I cannot find a decent source that would say they should), given the fact that all the text in the second row is of approximately the same width.  I find this behaviour quite puzzling and have no idea what the cause could be. I know I could perhaps remedy this by manually setting the column widths, but am curious as to how to fix this without doing that (I do not need or indeed want the columns to be of the same width, but roughly proportional to the length of their content), preferably but not necessarily by using the tabular environment only (some other conflict with the document class I am using).   What is it that I'm doing or assuming wrong? And why?  MWE:  \documentclass{article} \begin{document}  \begin{tabular}{ccccc} \multicolumn{5}{c}{This is a piece of text. The longer it is, the longer the last column.} \\  1 &amp; 2 &amp; 3 &amp; 4 &amp; 5 \\ \hline \end{tabular}  \end{document}   Resulting table. Notice how the last column of the second row accumulates excess width.