Skip to main content

New answers tagged

0 votes

Top Vertical Alignment with Multirow

Here is a solution with {NiceTabular} of nicematrix. \documentclass{article} \usepackage{booktabs,fullpage} \usepackage{nicematrix,tikz} \begin{document} \begin{center} \begin{NiceTabular}{c>{\...
F. Pantigny's user avatar
  • 46.6k
1 vote

Advice for creating a clean table with tabularray

My main recommendation would be to transpose the table, because it's easier to scan down a column and compare values than it is to scan across a row. I also moved "capacity" into the ...
Teepeemm's user avatar
  • 7,983
1 vote

Advice for creating a clean table with tabularray

Firstly, thank you so much for the help, everyone. That was almost instantaneous feedback. Really appreciate it. I've actually gone with the design suggested by Skillmon. I rebuilt the "compact&...
suckingalemon's user avatar
0 votes

Latex partially colored makecell in table

With {NiceTabular} of nicematrix. \documentclass[12pt]{scrartcl} \usepackage{xcolor} \usepackage{nicematrix} \begin{document} \begin{table} \centering \begin{NiceTabular}{c|c|c|c} \...
F. Pantigny's user avatar
  • 46.6k
1 vote

Color merged and regular cells in a table individually

A tabularray implementation. Full code \documentclass[margin=2mm]{standalone} \usepackage{tabularray} \usepackage{xcolor} \begin{document} \begin{tblr}{ colspec={ *{4}{Q} }, cells = { halign=c,...
Emanuele Nardi's user avatar
3 votes
Accepted

Latex partially colored makecell in table

Instead of using makecell you could nest a tabular with only a single c-column in that cell: \documentclass[12pt]{scrartcl} \usepackage[table,xcdraw]{xcolor} \begin{document} \begin{table} \...
Skillmon's user avatar
  • 69.4k
1 vote

Answermatrix for Exam // Table/Matrix with fixed width and height independent of the content

I do not have a perfect solution, but it works for most parts. I was not able to do it without additional commands in the table. I needed to define these two commands to either always show the content ...
Titanlord's user avatar
  • 551
2 votes

LateX very long table fit width

Please, do yourself a favor and clean up your preamble: loading packages twice or more is just confusing, even more if you load them with contradictory options (look at geometry). Notice that subfig ...
egreg's user avatar
  • 1.2m
2 votes

Empty tabular for worksheet

By use of the tblr of tabularray package: \documentclass{article} \usepackage{tabularray} \begin{document} \begin{tblr}{colspec= { c *{3}{X}}, rows = {ht=3ex}, hlines, ...
Zarko's user avatar
  • 307k
3 votes

LateX very long table fit width

The class column is really repetitive; you'll save a lot of room if you can figure out a way to convey that information some other way. Here, I've moved it from a column to being its own row (except ...
Teepeemm's user avatar
  • 7,983
3 votes
Accepted

Table incorporated inside a longtable cell

It seems that you generate code for your table with some on-line generator. Consequently table code is big mess and full of clutter. Also it is unclear what your table should looks. Beside ...
Zarko's user avatar
  • 307k
4 votes

LateX very long table fit width

You load package xltabular, so why not use that. With 2 X columns you get a decent layout. You should remove the inner tabular environments, and replace the \\ inside these with \newline, otherwise it ...
Pieter van Oostrum's user avatar
3 votes

Tables: header fill with multirow

One more answer using tabularray package with using amsmath and booktabs libraries. Regarding booktabs rules: they have small amount vertical space around rules (as you observe as white space), ...
Zarko's user avatar
  • 307k
4 votes

Tables: header fill with multirow

I'm writing my thesis and I'd like to include some good-looking tables. Start by removing \multirow, color and boldface. The main headers should be on the same line. Multirow cells are ambiguous; ...
egreg's user avatar
  • 1.2m
8 votes

Tables: header fill with multirow

Here is an implementation of your table using the tabularray package. As for the packages you've loaded: \usepackage[utf8]{inputenc} is no longer needed since 2018, so you can safely remove it [...
Emanuele Nardi's user avatar
4 votes
Accepted

Tables: header fill with multirow

In your example, I have loaded nicematrix (unloaded colortbl) and replaced your environment {tabularx} by {NiceTabularX} of nicematrix. I have directly the expected output (after several compilations)....
F. Pantigny's user avatar
  • 46.6k
1 vote

How can Booktabs \toprule and \bottomrule be lengthened?

Since you're not using any columns of type X, there's no point in using a tabularx environment to begin with. You can automate the centering of a tabular environment that's wider than \textwidth by ...
Mico's user avatar
  • 530k
6 votes

How can Booktabs \toprule and \bottomrule be lengthened?

Your example \documentclass{article} \usepackage{graphicx} \usepackage{booktabs} \usepackage{tabularx} \begin{document} \begin{table*}[] \footnotesize \caption{A Table Caption} \hspace*{-3cm} \...
David Carlisle's user avatar
1 vote

blank space is showing on bottom of some pages in report

When you're typesetting your document with oneside mode LaTeX uses \raggedbottom (meaning that pages don't have to end on the same height). You can change that by invoking \flushbottom in your ...
Skillmon's user avatar
  • 69.4k
7 votes

Advice for creating a clean table with tabularray

My goal with tables is always to minimize repetition and make them as clear and straightforward as possible. % 'standalone' class used just to visually isolate the problem \documentclass[preview, ...
Emanuele Nardi's user avatar
4 votes

Advice for creating a clean table with tabularray

An alternative tblr of tabularray package table. I would use X columns type and package mhchem chem formulae for hydrogen. \documentclass{article} \usepackage{caption} \usepackage[version=4]{mhchem} \...
Zarko's user avatar
  • 307k
6 votes
Accepted

Advice for creating a clean table with tabularray

Full width versions I'd put the two different measurements into separate rows, also I'd get rid of all except 3 of the horizontal rules. I'd also drop the parentheses around the second measurement of ...
Skillmon's user avatar
  • 69.4k
4 votes

Advice for creating a clean table with tabularray

I suggest to: use fixed width columns for columns 2-5 and an X column for the first column. This way, tabularray can add line breaks to your texts and also adjust the width of the whole table to ...
samcarter_is_at_topanswers.xyz's user avatar
1 vote
Accepted

REnewcolumntype to surpress warning when using newcolumn to redefine a column

You can deactivate \PackageWarning: \documentclass{article} \usepackage{array} \NewCommandCopy{\RealPackageWarning}{\PackageWarning} \newcommand*{\DeactivatePackageWarning}{\renewcommand*{\...
cabohah's user avatar
  • 18.7k
3 votes

REnewcolumntype to surpress warning when using newcolumn to redefine a column

just as you can let a command to \relax to avoid an error from \newcommand you can do the same here. \documentclass{article} \usepackage{array} \newcolumntype{\examplecolumn}{} \ExpandArgs{c}\let{NC@...
David Carlisle's user avatar
6 votes
Accepted

Is it possible to manipulate or transform the input within an environment?

You can loop: \documentclass{article} \usepackage{tabularray} \UseTblrLibrary{counter} \ExplSyntaxOn \NewDocumentEnvironment{chessmoves}{b} { % split the environment's contents into items at the \...
egreg's user avatar
  • 1.2m
4 votes

Is it possible to manipulate or transform the input within an environment?

You can use \SplitList argument processor, together with the \ProcessList command \NewDocumentEnvironment{chessmoves}{ >{\SplitList{/}} +b }{% \ProcessList{#1}{\typesetmove} }{} Here I use / to ...
jlab's user avatar
  • 8,324
2 votes

Is it possible to manipulate or transform the input within an environment?

This might serve as a starting point. \documentclass{article} \usepackage{environ} \usepackage{tabularray} \UseTblrLibrary{counter} \newcounter{moveno} \newcommand{\moveno}{\stepcounter{moveno}\...
Emanuele Nardi's user avatar
5 votes

The first row in a tabularray does not start at 1

Like this? For numbering I would use tblr option: cell{2-Z}{1} = {cmd=\the\numexpr\arabic{rownum}-1.}, Beside this I would no insert table in `adjustbox7. Beter and more coesistent is to determine ...
Zarko's user avatar
  • 307k
3 votes

The first row in a tabularray does not start at 1

Tabularray does count the header row as a row, so the counter is workings as intended. However you can define a new command to print rownum - 1 as follows: \newcommand{\Rownum}{\inteval{\value{rownum}-...
Mane32's user avatar
  • 2,768
3 votes

Centering Images and text inside a table

Another possible approach with the tabularray package in combination with adjustbox: \documentclass{article} \usepackage{caption} \usepackage{tabularray} \usepackage[export]{adjustbox} \usepackage{...
samcarter_is_at_topanswers.xyz's user avatar
3 votes

table with images

Like in your other question, I'd use tabularray. This makes it not only easy to centre the images, but also to adjust the relative column widths: \documentclass{article} \usepackage{geometry} \...
samcarter_is_at_topanswers.xyz's user avatar
3 votes

How to label lines and columns of a matrix?

No extra package is needed. TeX can do it, as suggested by mickep: \documentclass{article} \begin{document} \[ \bordermatrix{ & C & D \cr C & b-c & -c \cr D ...
invictus's user avatar
  • 811
3 votes

How to label lines and columns of a matrix?

A solution with spalign package: \documentclass[12pt]{article} \usepackage{spalign} \begin{document} \[ \def\spalignendline{\cr} \spalignrun{\bordermatrix{\the\spaligntoks}} {, C D; C b-c -c; D b 0 } ...
Sebastiano's user avatar
2 votes

Creating tables dynamically

You can't use \foreach to span columns. I'd define a general purpose \stepdo command, that we can apply in the specific case. The last argument is a template where the current value in the loop is ...
egreg's user avatar
  • 1.2m
3 votes

How do I vertically center the cells in specific columns of a table?

I'd use tabularx and no nested tabular: just help LaTeX to state points where lines must be broken and add ties for things that should not be broken across lines. I use a devious trick in order to get ...
egreg's user avatar
  • 1.2m
2 votes

How do I vertically center the cells in specific columns of a table?

I recommend that you employ a tabularx environment instead of a tabular environment and use the package's X column type for column 2. That way, you can let LaTeX perform any needed line-breaking ...
Mico's user avatar
  • 530k
6 votes

How do I vertically center the cells in specific columns of a table?

I've recreated your table using the tabularray package, which provides significantly more versatility for your requirements. While I personally avoid using vertical lines in tables, the decision is ...
Emanuele Nardi's user avatar
6 votes

How do I vertically center the cells in specific columns of a table?

If you use \begin{tabular}[t] you force the tables to be top aligned. If you don't want them to be top aligned, don't add use the t option (or if you must use the optional argument, replace it with c ...
samcarter_is_at_topanswers.xyz's user avatar
5 votes
Accepted

Creating tables dynamically

\foreach of pgffor creates a TeX group which interferes with the & of the tabular. I suggest to use \int_step_inline:nn for the loop. In order to use that command of the L3 programming layer, you ...
F. Pantigny's user avatar
  • 46.6k
2 votes

Latex code for tabular method of convolution

If you actually want to construct your table with such design (maybe not a good idea: see other answers), here is a way with nicematrix. \documentclass{article} \usepackage{nicematrix} \begin{...
F. Pantigny's user avatar
  • 46.6k
3 votes

Latex code for tabular method of convolution

With tabularray ans spreadtab. Like a spreadsheet, we copy the formula to the right and below with & -1 & 2 & 0 & 1\\ 3 & \STcopy{>,v}{!a3*b!2}&&...
pascal974's user avatar
  • 7,200
1 vote
Accepted

Images in table alignment

You can use the valign=c option from adjustbox to centre your images vertically: \documentclass{article} \usepackage{tabularray} \usepackage[export]{adjustbox} \usepackage[hmargin=2cm]{geometry} \...
samcarter_is_at_topanswers.xyz's user avatar
5 votes
Accepted

table with images

Here's a solution that employs the xltabular package and eponymous environment. Basically, xltabular combines the capabilities of longtable (allow page breaks in the table) and tabularx (set a target ...
Mico's user avatar
  • 530k
5 votes

Latex code for tabular method of convolution

Here is another idea to present the information which avoids the slash and uses only standard commands. \documentclass{article} \usepackage{array} \begin{document} \begin{tabular}{rl} & $\...
invictus's user avatar
  • 811
1 vote

Multirow in table bigger than single rows

I suggest you use nested matrix and pmatrix environments. No need to fiddle with \multirow directives. And, by using \midrule and \bottomrule, two macros provided by the booktabs package, one can meet ...
Mico's user avatar
  • 530k
4 votes

Latex code for tabular method of convolution

The typographic quality of that table is really poor. The slash is to be avoided as it doesn't really make clear what the entries refer to. \documentclass{article} \usepackage{booktabs,siunitx} \...
egreg's user avatar
  • 1.2m
7 votes

Latex code for tabular method of convolution

Here's a quick and easy solution using the tabularray package: Here's the code: \documentclass{article} \usepackage{tabularray} \UseTblrLibrary{diagbox} \begin{document} \( \begin{tblr}{ hline{...
Atex's user avatar
  • 1,146
5 votes

Latex code for tabular method of convolution

The following implements your table, but it doesn't use the diagonally split cell for the header (because I don't like the looks of it), if you absolutely have to have this, you can use diagbox to ...
Skillmon's user avatar
  • 69.4k
3 votes

Multirow in table bigger than single rows

Like this? Instead of tabular package I would rather use tblr of tabularray package on the following way without use of multi row cells: \documentclass[margin=3mm]{standalone} \usepackage{tabularray} ...
Zarko's user avatar
  • 307k

Top 50 recent answers are included