# Tag Info

## Hot answers tagged tables

11

With TikZ it is far simpler: The code: \documentclass[tikz,border=10pt]{standalone} \usepackage{tikz} \usetikzlibrary{calc,matrix} \begin{document} \begin{tikzpicture}[element/.style={minimum width=1.75cm,minimum height=0.85cm}] \matrix (m) [matrix of nodes,nodes={element},column sep=-\pgflinewidth, row sep=-\pgflinewidth,]{ & Factor 1 ...

9

You could use \cline instructions and use \multicolumn{1}{c}{...} in the header row to suppress vertical lines. I've provided some visual formatting hooks (such as \quad and \lower in the MWE below; I trust you'll manage to figure out how to move the elements around some more using these hooks. \documentclass[a4paper,12pt]{article} ...

8

There is a package for typesetting strategic form games: sgame, by Martin Osborne. Code \documentclass{article} \usepackage{sgame} % \renewcommand\gamestretch{2} % double row height \begin{document} \begin{game}{2}{2}[\textbf{Name 2}][\textbf{Name 1}] & Factor 1 & Factor 2 \\ Factor 1 & 5 & 4 \\ Factor 2 ...

7

It's easy if you invert the input order and enter the data columnwise rather than row wise (and your data is fairly regular, large entries would mess up the alignment. I used c here but you could fix the column with with p{..} \documentclass{article} \newcommand\zcolumn[1]{% \begin{tabular}[b]{c}#1\end{tabular}\linebreak[0]\ignorespaces} \begin{document} ...

6

With mighty tikz and tikzmark: \documentclass{article} \usepackage{tabularx} \usepackage{colortbl} \usepackage{tikz} \newcommand\tikzmark[2][]{ \tikz[remember picture,inner sep=\tabcolsep,outer sep=0,baseline=(#1.base),align=left]{\node[minimum width=\hsize](#1){$#2$};} } \begin{document} \begin{tabularx}{8cm}{|X|X|X|X|} \hline ...

6

You can achieve this with the command \setbeamertemplate{caption}{\insertcaption} Put this line in the preamble if you want this behavior for all your captions, or inside the specific float if you want it to be local. MWE \documentclass[10pt,t]{beamer} \usetheme{default} \setbeamertemplate{caption}{\insertcaption} \begin{document} \begin{frame} ...

6

If you only need a blank table, this can be the code: \documentclass{article} \begin{document} \begin{tabular}{|p{3cm}|p{1.5cm}|p{1.5cm}|p{1.5cm}|p{1.5cm}|} \hline & \multicolumn{2}{l|}{} & \multicolumn{2}{l|}{} \\ \hline &&&& \\ \hline &&&& \\ \hline &&&& \\ \hline &&&& \\ \hline ...

5

\tabcolsep is a length not a macro so it should be set using \setlength\tabcolsep{10pt} Not \renewcommand. You can set it anywhere before the table, if you set it in the document preamble it will apply to all tables in the document. If you want to affect just one table that you are inputting then you can do {\setlength\tabcolsep{15pt}\input{tablefile}} ...

5

I've rearranged various parts of your code to make it look more like the images you've posted, since this is apparently how you would like the table to look. In particular, do note that if you want the standard errors associated with the coefficient estimates to show up below the coefficients, they need to be in their own separate row, not in the form 0.39 ...

5

You can get cells that span two columns with the \multicolumn command, e.g., \multicolumn{2}{c}{Heading}. Vertical lines you put in the format, horizontal lines in the content: \begin{tabular}{|l|l|l|l|l|} \hline r1c1 & \multicolumn{2}{c}{r1c2-3} & \multicolumn{2}{c}{r1c4-5} \\ \hline etc. \end{tabular} However, before you go any further with ...

5

Don't use the PlainTeX \centerline macro in a LaTeX document. If the contents of every single column should be typeset centered, it's better to define column types that do so automatically, without the user having to type lots and lots of \centering instructions. This idea is implemented in the example below. By the way, the user guide of the array package ...

5

You're not taking into account the horizontal spacing buffering the cells. Try something along these lines: \documentclass[12pt,a4paper]{article} \usepackage{tabularx} \usepackage[english]{babel} \usepackage{blindtext} \begin{document} \begin{tabularx}{\linewidth}{c|X|X} row & row & row\\ \hline row & \multicolumn{2}{l|}{%% \noindent ...

5

I would recommend not widening a tabular beyond its natural width. With tabular* you can avoid “phantom columns”, if you really want to enlarge the intercolumn spaces. With facilities from siunitx it's easy to make tables containing numeric data. \documentclass[a4paper]{article} \usepackage{siunitx,booktabs} \begin{document} % natural width ...

4

itemize inside tabular is allowed, but properly used. In the following there are two examples of usage, with different outputs. \documentclass{article} \begin{document} %\begin{tabular}{ll} \begin{tabular}{lp{8cm}} 560 v. Chr. & \begin{itemize} \item erster Eintrag \item zweiter Eintrag ...

4

Breaking within a row would be really hard to specify (even if it didn't require re-writing most of longtable) consider that the cells may have text of different baselines, or images or nested tables, and you'd have to find a consistent place to break each column. If your real example is just one column then you don't need a table at all of course, and ...

4

Assuming you want to stick with the dcolumn package, there are two important optimizations you could make which, jointly, would let you use a fontsize directive of \small rather than \scriptsize and still make the table fit into the available text block: Define your decimal column layout via \newcolumntype{Y}{D{.}{.}{1.2}} rather than the generic ...

4

write into the preamble after loading tabulary: \usepackage{etoolbox} \preto\tabular{\global\rownum=0\relax} or without loading a package: \let\Tabular\tabular \def\tabular{\global\rownum=0\relax\Tabular} it is a problem with all tabular packages which read its contents twice for calculating the width.

3

With siunitx you can have an easier input; I'd prefer \si{\degree} to \degree. \documentclass{article} \usepackage{siunitx} \usepackage{booktabs} \begin{document} \begin{tabular}{ c S[table-format=3, table-space-text-post=\si{\degree} ]<{\si{\degree}} S[table-format=4] } \toprule Elevation range & \multicolumn{1}{c}{Azimuth resolution} ...

3

To narrow the tables you should drop empty columns and maybe reorganize them a bit. And there are several other points to improve them. The »booktabs« package for a better look especially regarding the horizontal rules. The »siunitx« package for digit alignment in the respective columns. The »threeparttable« package for table notes instead of footnotes. ...

3

Using array package would enable you to simplify the markup a bit, nut you can do \begin{tabular}{|p{3cm}|p{1.5cm}|p{1.5cm}|p{1.5cm}|p{1.5cm}|} \hline \centering {image} & \multicolumn{2}{c|}{ABC} & \multicolumn{2}{c|}{DEF} \tabularnewline \hline & \centering A&\centering B&\centering C&\centering D \tabularnewline \hline ...

3

Thanks for uploading the "raw" contents of your file via the excel2latex utility. I like the fact that the base solution uses the booktabs package and features no vertical rules. :-) Relative to your baseline tabular solution, I would suggest making the following adjustments: Use a tabularx environment, and set its width to \textwidth (the width of the ...

3

Just use \begin{tabular}{p{\the\MyLen}@{}p{\the\MyLenTwo}@{}p{\the\MyLenThree}@{}} First&Second&Third \\ \end{tabular} As there is no flexibility in the glue between columns, tabular* can not change the width in any way, so the width using tabular* will be as for tabular but then forced into a box of the specified size, so generating a warning if ...

3

Such a table is very awkward to read: you have it sideways and the column headers are sideways too. It's better to transpose it: \documentclass{article} \usepackage{booktabs} \begin{document} \begin{table}[htp] \centering \begin{tabular}{lcc} \toprule Interval & Ratio & Note \\ \midrule Unison & $\frac{1}{1}$ & C \\ \addlinespace Minor ...

2

Your code, at least as posted, contains a lot of errors and does not compile. I've tried to clean it up as best I could. Among other things, I've gotten rid of all vertical lines; IMHO vertical lines provide mostly clutter. I've also replaced various \hline instructions with \toprule, \midrule, and \bottomrule, three commands of the booktabs package that ...

2

For the rotated labels, I used a combination of spaces and \llap. For the justification, I invoked \raggedright for each itemize environment. \documentclass[a4paper,11pt]{article} \usepackage{a4wide} \usepackage{enumitem} \usepackage{array} \usepackage{rotating} \begin{document} \begin{table}[h!] \begin{center} \footnotesize \begin{tabular}{|l|l|l|l|l|} ...

2

The command is error for your \resizebox. Should be \resizebox{xxcm}{!} { % ! keep the aspectratio with xx width, no need to use width=xx. \begin{tabular}... \end{tabular} } Also \scalebox from graphicx works too. \scalebox{0.7}{ \begin{tabular}... \end{tabular} } Code \documentclass{beamer} \usepackage{graphicx} ...

2

Following Christian's comment, I wrote the following code: \documentclass{article} \usepackage{pgfplotstable} \begin{document} \newcommand{\filtercode}{% \pgfmathparse{int(less(\cellvalue, 0.01))}% \ifnum\pgfmathresult=1 % \edef\cellvalue{x}% \else \pgfmathparse{int(less(\cellvalue, .1))}% ...

2

I don't know if there's a good way to do this, so I'll suggest a hack and possibly not a particularly good one. The trick is to alternately replace \\ with \crsng and \crdbl. The former is just equivalent to your old \\ and the latter is equivalent to your old \\[6pt]. Introduce the following before \begin{tabular}: \global\let\restorecr=\\ Introduce ...

2

You can enter a "widthless" box with height equal to 6 lines to that cell: \rule{0pt}{6\baselineskip} By default, however, the bottom of the box is aligned with the baseline of the first line. To top-align the box, one can use the adjustbox package: \adjustbox{valign=t}{\rule{0pt}{6\baselineskip}} Full Code \documentclass[10pt]{article} ...

2

Here is a much simpler solution. \documentclass[10pt]{article} \usepackage[margin=2cm]{geometry} % just for the example \usepackage{tikz} \newcommand\Text{Quisque ullamcorper placerat ipsum. Cras nibh. Lorem ipsum dolor sit amet} \newlength{\cellW}% cell width (inner) \setlength{\cellW}{0.2\textwidth} % outer width = inner width + .6666em (initial) ...

Only top voted, non community-wiki answers of a minimum length are eligible