13 votes
Accepted

LaTeX tables lines are not connected

The problem is that in your code you use \multicolumn{2}{}{} in the second column, but in the second row you use it in the third column. This, of course, does not line up. I assume that the code you ...
Jasper Habicht's user avatar
10 votes
Accepted

Automated Dijkstra Visualization

Here's the Dijkstra algorithm in TeX. It uses the PGFFor (the .list handler) and PGFMath (the \pgfmathloop) for looping: The .list handler gets used to store the weights of each edge and to do all ...
Qrrbrbirlbel's user avatar
10 votes
Accepted

align by any character in tabular

Piece of cake with the dcolumn package and its D column type. I'm pretty sure that the D column type is used much more frequently with . or , as the decimal marker. However, there's no reason for not ...
Mico's user avatar
  • 506k
10 votes
Accepted

Get rid of extra white space inserted when using \verb with tabularx

You can use \Verb from fancyvrb, but with the better definition provided by fvextra. \documentclass{article} \usepackage{tabularx} \usepackage{fvextra} \begin{document} \Verb|tabular| \noindent \...
egreg's user avatar
  • 1.1m
10 votes
Accepted

UTF8 not (fully) working in tables

If you want to switch \familydefault, you should do it before \begin{document} or explicitly use \normalfont afterwards in order to actually use it, otherwise the currently loaded font is still the ...
Marcel Krüger's user avatar
9 votes

How to make better looking tables for e.g. a publication?

My suggestions would be: Only use \multicolumn where it relly belongs. It hardly makes sence in your example to use it to span over just one single column (and I really wonder why so many people ...
Jasper Habicht's user avatar
9 votes
Accepted

LaTeX Table to Standalone?

I don't think that using a tabularx environment with two equally wide columns and some ensuing line-breaks in the first column generates a good layout. I'd go with a basic tabular environment, use l ...
Mico's user avatar
  • 506k
9 votes

Call alternating row colors from within the table?

Like this (change colors and alignment as You like)? Code: \documentclass{article} \usepackage[table]{xcolor} \begin{document} \begin{center} \rowcolors{2}{gray!50}{white} ...
Raffaele Santoro's user avatar
9 votes
Accepted

Creating a Complex Diagram with TikZ in LaTeX, Including Itemized List and Citations

I started to code your question. From that point on you should be able to complete it by yourself. I placed the rectangles as nodes and used relative positioning, so that they always have the same ...
DraUX's user avatar
  • 493
9 votes

How can I make this table?

I'd avoid that dramatic spacing and also the too big squares. I'd also avoid rules as much as possible, see the second realization. \documentclass{article} \usepackage{xcolor} % for '\fcolorbox' macro ...
egreg's user avatar
  • 1.1m
8 votes

LaTeX Table to Standalone?

As compliment to nice @Mico answer (+1), with use of the tabularray package, i.e. with its talltblr environment which is equivalent to classic threeparttable: \documentclass[border=3.141592]{...
Zarko's user avatar
  • 296k
8 votes

Why is a part of my table open?

To fill in the gaps in two of the four vertical lines, you need to change the line & \\ located immediately below the header line to & & & \\. Or, just delete this line. I would also ...
Mico's user avatar
  • 506k
8 votes
Accepted

Why is a part of my table open?

Beside use siunitx (omitted here in order to not mess the MWE) to fit the width of the whole table without headaches, consider use tabulary or tabularx (in this case, better the first) and on the ...
Fran's user avatar
  • 80.6k
8 votes
Accepted

Table with weird borders with the booktabs package

A solution with the tabularray package: \documentclass{beamer} \usepackage{tabularray} \begin{document} \frame{ \begin{tblr}{ colspec = { *{3}{c }}, hline{1} = {1}{2-3}{}, ...
Jasper Habicht's user avatar
8 votes
Accepted

Horizontal tabular borders and `\arrayrulecolor` in beamer

See this nice answer for a solution. The problem is that beamer redefines the macro \reset@color which is used to change the color for rules when using hhline together with colortbl. It is redefined, ...
Jasper Habicht's user avatar
8 votes

Writing a map in Latex

You cannot use align* in a table cell. You can instead use aligned, but tabular is not needed. \documentclass{article} \usepackage{amsmath} \begin{document} \[ \boxed{ \begin{aligned} {\cdot} :...
egreg's user avatar
  • 1.1m
8 votes
Accepted

Why I get undefined control sequence with cline?

The class is written quite horribly. If you don't have to use it, then use another one. Anyway, the problem here is that it defines \toprule and \bottomrule similar to those of booktabs but... no idea ...
campa's user avatar
  • 31.1k
8 votes
Accepted

Automatic number formating in a table

You could use an S column (from the siunitx package) to apply it to the whole column: % !TeX TS-program = lualatex \documentclass{article}[10pt] \usepackage[ngerman]{babel} % this is needed for ...
samcarter_is_at_topanswers.xyz's user avatar
8 votes

Reproduce the table of Exercise 22.7 in the TeXbook

Here's a solution that preserves Knuth's definition of \welshverb, apart from the minor change from \bf to \bfseries. \documentclass{article} % or some other suitable document class \usepackage{array}...
Mico's user avatar
  • 506k
8 votes
Accepted

A convenient way to typeset this diagram of the three MIPS instruction formats

Very easy job with bytefield package. \documentclass{article} \usepackage{bytefield} \usepackage{calc} \begin{document} \begin{bytefield}[leftcurly=., leftcurlyspace=0pt]{32} \bitheader[endianness=...
CarLaTeX's user avatar
  • 62.5k
8 votes

LaTeX tables lines are not connected

I suggest you use a tabular* environment to assure that the table fits inside the textblock or, equivalently, that the table's width equals \textwidth. I'd also assure that the 12 data columns have ...
Mico's user avatar
  • 506k
8 votes
Accepted

Add pattern to LaTeX table cell

With {NiceTabular} of nicematrix and TikZ to draw the patterns. \documentclass[landscape,a4paper]{article} \usepackage{graphicx,caption} \usepackage[top=0.5cm,bottom=3.8cm,right=2cm,left=2cm]{geometry}...
F. Pantigny's user avatar
8 votes
Accepted

Set Boxes in a table

I suggest you employ the colortbl package and its \arrayrulecolor macro, along with \cline directives before the first row and after the final row. Optionally, change the line widths by resetting \...
Mico's user avatar
  • 506k
8 votes

Set Boxes in a table

\documentclass[11pt]{article} \usepackage{tikz} \usepackage{nicematrix} \begin{document} \begin{NiceTabular}{*{12}{>{\fpeval{\value{iRow}*12+\value{jCol}-13}}c}} &&&&&...
polyn's user avatar
  • 5,519
8 votes

How to reduce the left-padding of a table cell?

You could use \colorbox instead of \cellcolor. \documentclass{memoir} \usepackage{xcolor} % for '\colorbox' macro \usepackage{siunitx} % for 'S' column type \usepackage{booktabs}% for '\toprule' and ...
Mico's user avatar
  • 506k
8 votes
Accepted

How to reduce the left-padding of a table cell?

With nicematrix (and tikz) you can set precisely the inner ysep and inner xsep. \documentclass{memoir} \usepackage{nicematrix, tikz} \usetikzlibrary{fit} \tikzset{highlight/.style={fill=gray!30, ...
Sandy G's user avatar
  • 42.4k
8 votes
Accepted

Is it possible to perform arithmetic on the entries in a table?

No need for the complicated answers like spreadtab if all you want to do is summing up all values in a single column. The following does that using the collcell package, a \newcolumntype and a small ...
Skillmon's user avatar
  • 60.4k
8 votes
Accepted

Logic proof - Boxes inside a table

The logicproof package was designed with the precise aim. \documentclass{article} \usepackage{logicproof} \begin{document} \begin{logicproof}{2} \begin{subproof} (\lnot (\alpha \lor (\lnot \alpha))...
egreg's user avatar
  • 1.1m
8 votes

Using siunitx, how to simultaneously align values by decimal points and in the center in all columns of table?

If you want to make effective use of the machinery of the siunitx package, I suggest you express the uncertainty amounts as single-digit entities; say, as (2) instead of as (0.2). This'll give you the ...
Mico's user avatar
  • 506k
7 votes

How do I make this table better looking?

I'd like to suggest that you start by getting rid of all vertical rules and most horizontal rules. Next, use the macros \toprule, \midrule, \addlinespace, and \bottomrule instead of \hline, as is done ...
Mico's user avatar
  • 506k

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