Hot answers tagged

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
6 votes

Add more vertical space in a table row

Updated: use dmath mode. \documentclass{article} \usepackage{xcolor} \usepackage{tabularray} \begin{document} \begin{tblr} { colspec = {Q[c,m]Q[c,m]}, hlines,vlines, row{1} = {bg=green}, cells = {...
Clara's user avatar
  • 5,177
6 votes
Accepted

column widths when using multicolumn

You defined 4 columns but your table has only 3. \documentclass{article} \usepackage[margin=2cm,a4paper]{geometry} % set page parameters suitably \usepackage[T1]{fontenc} \usepackage[english]{babel} \...
CarLaTeX's user avatar
  • 60.5k
5 votes
Accepted

Cline not working

With tabularray: \documentclass{article} \usepackage{xcolor} \usepackage{etoolbox} \usepackage{tabularray} \makeatletter \ExplSyntaxOn % https://tex.stackexchange.com/questions/629708 \pretocmd{\@...
Zarko's user avatar
  • 283k
5 votes
Accepted

Vertical align text in tabular

You may achieve your formatting objective by getting rid of the \multirow wrappers. I'd further like to suggest that you switch to a tabularx environment, so that you can get rid of the \resizebox ...
Mico's user avatar
  • 478k
5 votes

Custom environment to create table-like matrix

Quite simple with tabularray: \documentclass{article} \usepackage{amsmath} \usepackage{tabularray} \NewDocumentEnvironment{tabularmatrix}{+b}{ \begin{tblr}{ hlines, vlines, columns={c}, ...
CarLaTeX's user avatar
  • 60.5k
4 votes
Accepted

Table with text aligned at a specific point and setting specific row width

This should be close to what you're looking for. The aligned subsidiary environment from amsmath works in horizontal mode. It requires a vertical positioning option to keep it in proper alignment ...
barbara beeton's user avatar
4 votes

Tables containing Young diagrams

I'd not use caged tables, see the second realization. \documentclass[11pt]{article} \usepackage[aligntableaux=center]{ytableau} \usepackage{booktabs} \usepackage{mathtools} \usepackage{array} \...
egreg's user avatar
  • 1.1m
4 votes

(Challenge) Making a table with checklists and proper alignment

What about this as a start point? With some more work you can fix it as you like: alignment, spaces, lines ... \documentclass[12pt]{article} \usepackage{bbding} % for square definition \usepackage[...
miltos's user avatar
  • 2,310
4 votes
Accepted

Using \NewDocumentCommand to redefine a table rule

You should use \NewExpandableDocumentCommand to define. As David said xparse is not needed unless you have an old latex release. I also suggest you to use tabularray to typeset your table, it's easy ...
Clara's user avatar
  • 5,177
4 votes

Add more vertical space in a table row

With {NiceTabular} of nicematrix. \documentclass{article} \usepackage{nicematrix} \begin{document} \begin{NiceTabular}{cc}[hvlines,colortbl-like,cell-space-limits=3pt] \rowcolor{green} $x$ & $g(...
F. Pantigny's user avatar
  • 32.9k
4 votes

Custom environment to create table-like matrix

If you don't need to nest arrays or other objects using \\, you can do it as follows. Any number of columns are accepted, as long as they're at most MaxMatrixCols, like for matrix in amsmath; increase ...
egreg's user avatar
  • 1.1m
4 votes

Custom environment to create table-like matrix

Not exactly a solution since it doesn't use your preferred name for the environment, but you can use nicematrix. You must compile twice. \documentclass{article} \usepackage{nicematrix} \begin{...
Sandy G's user avatar
  • 35.6k
3 votes

Cline not working

The line generated with \cline is covered by the color of the cell. This is why it is not visible. A solution could be to use the hhline package, which would require a small adjustment in the row ...
Jasper Habicht's user avatar
3 votes

tabular multicolumn - weird cell size

With {NiceTabular} of nicematrix. \documentclass{beamer} \mode<presentation>{\usetheme{Madrid}} \usepackage{nicematrix} \begin{document} \newcolumntype{C}{>{\columncolor{black}\color{white}}...
F. Pantigny's user avatar
  • 32.9k
3 votes
Accepted

Horizontal and vertical centering in xltabular

To obtain vertical centering of the contents of the first column, you need to run \renewcommand\tabularxcolumn[1]{m{#1}}. This is explained on page 3 of the user guide of the tabularx package. I would ...
Mico's user avatar
  • 478k
3 votes

Horizontal and vertical centering in xltabular

\documentclass[12pt]{article} \usepackage[letterpaper, left=3cm, right=2cm, top=3cm, bottom=2cm]{geometry} \usepackage[spanish, es-tabla]{babel} \usepackage{multirow, array} \usepackage[document]{...
user187802's user avatar
  • 15.5k
3 votes

Resizing the table

For the sake of completeness, here's a tabularx-based solution, with a target width of \textwidth. \documentclass{article} \usepackage[english]{babel} \pagestyle{empty} \usepackage[letterpaper,...
Mico's user avatar
  • 478k
3 votes
Accepted

Resizing the table

You can set font size as \small and reduce the column sep. tabularray is easy to use. \documentclass{article} \pagestyle{empty} \usepackage[letterpaper,top=2cm,bottom=2cm,left=3cm,right=3cm,...
Clara's user avatar
  • 5,177
3 votes
Accepted

Why is my number not showing up in scientific notation inside a 'S'-type column?

the first value in the last column is missing the scientific notation format that was included in the script. This is happening because you've defined the last column to be formatted as S[table-...
Mico's user avatar
  • 478k
3 votes

Tables containing Young diagrams

I just use the setting proposed by @samcarter_is_at_topanswers.xyz combined with tabularray. \documentclass[epic,11pt]{article} \usepackage[aligntableaux=center]{ytableau} \usepackage{tabularray} \...
projetmbc's user avatar
  • 12.9k
3 votes
Accepted

(Challenge) Making a table with checklists and proper alignment

Regarding your reputation, you should know, that this site is not service we-will-do-your-task-instead-you, so you should show what you try Question is not some challenge but rather simple table with ...
Zarko's user avatar
  • 283k
3 votes
Accepted

Add more vertical space in a table row

A variation of @clara answer, where is increased vertical space around cells contents for 5pt and and reorganized table preamble: \documentclass{article} \usepackage{xcolor} \usepackage{tabularray} \...
Zarko's user avatar
  • 283k
3 votes
Accepted

Minimizing Extra Spaces in Exam Headers and possible improvements

Here are two different fixes: The first (the recommended) is a single table using tabulary, multirow and array, and the other is your nested tabulars with the fixes of the comments, plus tabularx ...
Fran's user avatar
  • 77.3k
3 votes

How to horizontally center p type columns in tabular?

We have Overfull hbox 2.15 too wide with p{0.1cm}. I propose: \setlength{\tabcolsep}{4pt} (6pt by default) the packgage changepage to widen the margins for the table The code \documentclass{article} ...
pascal974's user avatar
  • 2,407
3 votes
Accepted

How to horizontally center p type columns in tabular?

You not provide any information about page layout. Column width of 0.1cm is far to small for content of cells, consequently it is spill out of this space (and cant be centered). Table size is to ...
Zarko's user avatar
  • 283k
3 votes

Rectangular framing some relations

I suggest you place an aligned environment inside a \boxed directive. \documentclass{article} % or some other suitable document class \usepackage{amsmath} % for 'aligned' env. and '\boxed' and '\text'...
Mico's user avatar
  • 478k
3 votes
Accepted

I do not understand the error. Is there a limit to the number variables in \foreach?

There's no problem with using 10 variables. The issue is \pgfmathparse{\groupmark+\markthree} receiving {} instead of a number. With the following changes your code compiles fine: \foreach \groupnum/\...
Sandy G's user avatar
  • 35.6k
3 votes

How to make a table like this?

I removed the padding in the first tabular and put the caption in the remaining space. I figure you already have the \captionsetup, so there was no point trying to reproduce it. For the second table ...
John Kormylo's user avatar
  • 75.3k
2 votes

How best to display an eventually periodic sequence in LaTeX

You can just input the first two rows and have automatically the changed items emphasized. \documentclass{article} \usepackage{amsmath} \ExplSyntaxOn % eventually periodic \NewDocumentCommand{\ep}{O{...
egreg's user avatar
  • 1.1m

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