113
votes
Increase LaTeX table row height
Super Simple Solution
I faced similar problem, & found a (not so conventional but) simple way to solve it. Wish, it will help others too.
I had a table like this-
\begin{tabular}{c|ccc}
$x$ &...
110
votes
Accepted
My table doesn't fit; what are my options?
Let's first identify what we're referring to when we use the term "table". The typical table environment is a float, and can contain anything: a paragraph of text, an image, or even a ...
73
votes
Accepted
How to left align text in a table with \makecell
You just have to write \makecell[l]{…} if you want to left-align (it is vertically and horizontally centred by default).
However, rather than using \resizebox I would suggest one of these two ...
56
votes
Adding space between columns in a table
If you need to adjust the spacing for just one table you could also add/remove some space before the table and restore previous value after it:
\addtolength{\tabcolsep}{-1pt}
\begin{tabular}{cc} ...
53
votes
Accepted
newline in multirow environment
There is several ways to do it. A very simple way is using \shortstack
\documentclass{article}
\usepackage[frenchb]{babel}
\usepackage[T1]{fontenc}
\usepackage{multirow}
\begin{document}
\begin{...
49
votes
Table with multiple lines in some cells
Another possible solution — my preferred one in my use-cases so far as I wanted full control to what comes in which line while being as concise as possible — is using the makecell package, which would ...
48
votes
How to center the table in Latex
You can also use \begin{center} ... \end{center}. This works better with beamer for example because {\centering ... } messes with the size of the table for some reason. The new code would be:
\begin{...
47
votes
Accepted
Tip on how to make a visually good table
I suggest you read the booktabs package documentation. Very good advices are given in there about table formatting and I think it is a good introduction on the subject.
About your example, the ...
46
votes
Accepted
Right alignment for p{length} box in tabular
Insert one of the commands \raggedright, \centering, or \raggedleft into the parbox depending on whether the paragraph should be typeset flush left, centered, or flush right.
\documentclass{article}
\...
45
votes
The space between the table and its caption is very small
My attention was drawn to this question by another one that had been posted on TeX-LaTeX Meta. In spite of having been asked almost six years ago, not only—IMHO, of course!—is this question still ...
45
votes
How does the \newcolumntype command work?
The array package documentation, on pages 2 and 3 has the explanations:
Additional explanation
To answer your specific question:
\newcolumntype{Y}{>{\small\raggedright\arraybackslash}X}
defines ...
44
votes
What is the difference between tabular, tabular* and tabularx environments?
Check out the following MWE:
\documentclass{article}
\usepackage{tabularx}
\begin{document}
\begin{tabular}{|l|c|r|}
\hline
foo & bar & fubar \\
fubar & toobar & foo \\
...
39
votes
Reducing column separation between specific columns
The column specification allows for the insertion of @{<stuff>} between columns. If <stuff> is empty (as in @{}), no column gap is inserted, while the "default" is @{\hspace{\tabcolsep}} ...
38
votes
How can I draw this complex table in LaTeX?
I'd like to propose you choose a layout that's quite different from the screenshot shown in your query. While that layout features a certain hierarchy of objects, the multitude of line styles give it ...
37
votes
Accepted
“Paragraph ended before \verbatim@ was complete.” when trying to use verbatim in tabular
Use \begin{frame}[fragile]. This option is needed when the content contains verbatim.
37
votes
Accepted
labels with tabular
You can't \label a tabular, because a tabular does not receive an intrinsic ordering scheme (aka a number) that can be referenced. But if you place the tabular inside of a table, you can \label that.
...
34
votes
Text alignment on top with multirow command
This is easily handled with the newly updated multirow command. There is an option that specifies vertical text alignment; put [t] for top alignment.
In your example you would write:
\multirow[t]{3}{...
34
votes
Accepted
Setting table-width exactly to linewidth
I think you have two good choices and a (likely) dreadful choice:
Use a tabular* environment,
Use a tabularx environment (or its close cousin, tabulary)
Use the basic tabular environment and scale ...
33
votes
newline in multirow environment
Simple with makecell, which is done for this sort of things: use the \multirowcell command (syntax even simpler than \multirow):
\documentclass{article}
\usepackage[frenchb]{babel}
\usepackage[T1]{...
33
votes
What is the difference between tabular, tabular* and tabularx environments?
I will begin by showing a screenshot of tabular, tabular* and tabularx versions of one and the same, admittedly contrived, table. The material in the first column is left-aligned; the material in the ...
32
votes
Accepted
Repeating the same column type
No pgffor package is required for this; just write your table preamble as:
\begin{tabular}{l *{6}{n{2}{3}}}
The general syntax is:
*{n}{column(s) pattern}
where n is the number of repetitions, ...
31
votes
Accepted
Changing width of table lines
Update
Use \arrayrulewidth from the preamble and place it before the desired table using a group to keep the change to \arrayrulewidth local:
\documentclass[11pt]{article}
\usepackage{array}
\begin{...
30
votes
Accepted
Convert this table to latex
As shown, this is a relatively complex table to format well since it requires the following elements:
rotated cells -> rotating package
cells which span multiple columns -> \multicolumn{<number of ...
29
votes
How to add a forced line break inside a table cell
Here I use stacks to accomplish it. Several things are noteworthy:
I demonstrate \Longstack , \Longunderstack and \Centerstack, which give three different alignments.
In order not to squeeze against ...
29
votes
Add notes under the table
You can use {\raggedright insert notes here \par} after \end{tabular} but before \end{table}:
\documentclass{article}
\begin{document}
\begin{table}
\centering
\caption{Sample ANOVA table}
...
29
votes
Beautiful table samples
Unfortunately, as of 2018-11-12, the tabu package is still unmaintained (see repository) and color are not working anymore.
Therefore my example below is not working.
Here is my modest contribution. ...
Community wiki
29
votes
Drawing Karnaugh's maps in LaTeX
Some days ago (Nov. 26), Mattias Jacobsson uploaded his karnaugh-map package to CTAN. Now instead of the code in my alternative answer you can use a real package.
karnaugh-map is also based in ...
29
votes
How to create a table with fixed column widths
This workaround in the preamble solves the problem. You can simply use C{width} for centered entries. Replace C with L or R if raggedright or raggedleft is favoured.
\usepackage{array}
\newcommand{\...
29
votes
Accepted
Autofit a table to the column width
EDIT
@Mico pointed out a much better solution to this problem, as tabularx already comes with the column type X, which automatically does what you want:
\documentclass{article}
\usepackage{tabularx}...
Only top scored, non community-wiki answers of a minimum length are eligible
Related Tags
tables × 17218tabularx × 1284
horizontal-alignment × 1036
longtable × 1003
vertical-alignment × 895
multirow × 811
multicolumn × 772
spacing × 653
captions × 589
floats × 576
color × 532
formatting × 506
tikz-pgf × 474
siunitx × 433
columns × 352
booktabs × 350
graphics × 332
beamer × 327
macros × 282
rotating × 275
align × 249
width × 249
line-breaking × 220
math-mode × 214
positioning × 207