New answers tagged

1

Since you load the array package, you may achieve your formatting objective by replacing the p column type with the m column type for column 1. Whatever else you may choose do, please replace >{\centering\arraybackslash}wc{0.1\textwidth} with w{c}{0.1\textwidth}. Put differently, please drop the >{\centering\arraybackslash} "prefix" of sorts. ...


1

you should protect material that siunitx should not align at the decimal number in S-columns by adding braces: \documentclass{article} \usepackage[export,demo]{adjustbox} \usepackage{siunitx} \begin{document} \begin{tabular}{|Sc|} {\includegraphics[valign=c]{example-image}} \\ \end{tabular} \end{document}


0

The following is how I'd recreate your table (but with top-aligned contents for the columns 1 and 2). I use booktabs for the rules, siunitx for the S-type columns which nicely align numbers, amsmath is just loaded for \boldsymbol to get a bold >, and I defined a macro for the table headers myself, to format all of them the same way (you could've used ...


1

You could use >{\centering\arraybackslash}m{2.5cm}, but there are several improvements that can be done on your table. Can anyone redesign my table? First: never repeat information. The first column is about data, so there's no need to repeat “Data” in each row. Second: the numbers should be aligned by their decimal separator, so they can be read and ...


0

An acceptable compromise could be: \begin{tabular}{>{\raggedright}m{90pt}*{8}{c}} % changed <<< \toprule & $F^{Ener}_{t}$ & $ F^{Prec_m}_{t}$ & $F^{Ind_m}_{t}$ & $ F^{Agr}_{t} $ & $ F^{Live_s}_{t}$ & $R^{\COVID}_{\substack{World}}$ & $ F^{China}_{j,t}$ & $ R^{\COVID}_{\substack{China}}$ \\ ...


0

You can turn the headers sideways. The rotating package provides an environment \begin{sideways}...\end{sideways} \documentclass[a4paper, 12pt]{article} \usepackage{booktabs} \usepackage{amsmath} \usepackage{rotating} \newcommand\sw[1]{\begin{sideways}$#1$\end{sideways}} \DeclareRobustCommand{\variablename}[1]{\mathop{\textnormal{\slshape #1}}\nolimits} \...


2

You can obtain what you want with >{\centering\arraybackslash}m{2.5cm} for the last column. However I would recommend loading siunitx and using the S column type to have numbers aligned on the decimal dot. Centring the column headers will be obtained by nesting them in a pair of braces. I also would load the caption package for a decent spacing between ...


0

The answer to my question is a more less not clearly documented option (lr) \documentclass[a4paper,11pt]{article} \usepackage[margin=2.5cm]{geometry} \usepackage[shorthands=off, bidi=basic, english, ngerman]{babel}% \usepackage[table]{xcolor} \usepackage{booktabs} \aboverulesep=0pt \belowrulesep=0pt \cmidrulekern=-\tabcolsep \usepackage{xltabular} % for ...


1

Load the TikZ library calc. It allows you to write ($(a)!0.5!(b)$) for the point between (a) and (b). Draw the circled numbers as circled nodes, not as fitted ones. Define the polygon with coordinates relative to its starting point, then you can shift it by shifting the starting point. Use \foreach loops to avoid duplication. When drawing a rectangular ...


2

Just use the [b] option for each tabular. I took the opportunity to put each fact in text mode, for a nicer layout: \documentclass{article} \usepackage{amsmath} \usepackage{tikz} \newcommand{\tikzmark}[2][-3pt]{\tikz[remember picture, overlay, baseline=-0.5ex]\node[#1](#2){};} \tikzset{brace/.style={decorate, decoration={brace}}, brace mirrored/.style={...


1

Upgrade to the most recent version of subfiles, 2020/11/14 v2.2. The problem you are experiencing is a bug in v2.1. The new version is already available in the distributions MiKTeX and TeXLive, as well as from CTAN and Github. I have verified that your table typesets correctly with v2.2.


1

Your table is too big for a4 paper, so the situation is much worse in the beamer frame. You need to restrict its width to \textwidth and enable to break text in cells into more line. For this is handy to use tabularx table: \documentclass{beamer} \usepackage{ragged2e} \usepackage{booktabs, tabularx} \newcolumntype{L}{>{\RaggedRight\hspace{0pt}}X} \begin{...


2

If you actually want vertical rules compatible with the horizontal rules of booktabs (even if it is not at all in the spirit of booktabs), you can use {NiceTabular} of nicematrix. \documentclass{article} \usepackage{booktabs} \usepackage{nicematrix} \usepackage{makecell} \usepackage{amsmath} % Start the document \begin{document} \begin{table} \centering % ...


1

From your comment I guess that you looking for something like this: (red lines indicate page layout. It is determined with geometry package). \documentclass[review]{elsarticle} \usepackage[margin=25mm]{geometry} \usepackage[table,xcdraw]{xcolor} \usepackage{booktabs, makecell, multirow} \usepackage{siunitx} %---------------- show page layout. don't use in ...


4

Here is a solution with {NiceTabular} of nicematrix. \documentclass{article} \usepackage[french]{babel} \usepackage{lmodern} \usepackage{nicematrix} \usepackage{tikz} \begin{document} \newcolumntype{:}{!{\vrule}} \begin{NiceTabular}{|llll:lll|} \Hline \noalign{\vspace{4mm}} & MASCULIN & FÉMININ & NEUTRE & MASCULIN & FÉMININ & ...


5

Typeset the table normally, including the headers. Add \tikznode commands for each header 'on the line'. Wrap the whole tabular into a \tikznode command. Add a tikzpicture to draw the lines. The \tikznode command is defined and described in this answer to "How to add arrow in equations and matrix". For fine-tuning, use the optional argument of \...


3

As in @Zarko's answer, I'd do away with all vertical lines -- trust me, they're not needed, and they won't be missed. I'd also left-align the cell contents, top-align the cell contents across rows, replace the second \toprule directive with \midrule, and replace the all-blank lines with the less profligate \addlinespace. \documentclass{article} \usepackage[...


3

I would write your tables like this: \documentclass{article} \usepackage{booktabs, makecell} \usepackage{amsmath} \begin{document} \begin{table} \centering % Centre the table on the slide \linespread{0.84}\selectfont \begin{tabular}{lccl} \toprule Name & Equation & Description & Variables\\ \midrule Reynolds & $...


0

The environment {NiceTabular} of nicematrix provides a command \Block which gives features similar to \multicolumn and \multirow. There is no problem using \Block inside \ifthenelse. \documentclass{article} \usepackage{ifthen} \usepackage{nicematrix} \newcommand{\essai}[1]{ \begin{NiceTabular}{cc} text & text \\ \hline \ifthenelse{\equal{#1}{...


0

You can do your tests outside the \table: \ifthenelse{\boolean{expr}} {\gdef\temp{\multicolumn{...}}} {\gdef\temp{something else}} ... \begin{tabular}{..} ...\\ \temp ...


2

\documentclass{article} \usepackage[margin=1in]{geometry} \usepackage{tabularx} \begin{document} \noindent \begin{tabularx}{\textwidth}{| X | X |} \hline \multicolumn{2}{| p{\dimexpr\textwidth-2\tabcolsep-2\arrayrulewidth} |}{\slshape\textbf{Declaration}: The project will be conducted in compliance with the University's Research Integrity Framework (...


0

A small variation of the nice @lenardiis answer (+1): added is possibility to hyphenate text in \multirow cells used \Xhline{...} defined in makecell package for horizontal rules in table \documentclass[12pt]{article} \usepackage{ragged2e} % new \hyphenation{im-ped-ance im-ped-ances} % <--- (source: https://www.hyphenator.net/en/word/) \...


1

It seems the \mC command has to expand to \multicolumn rather directly, without parsing for optional arguments. A plain \newcommand with three mandatory arguments works. You can define your mytabular such that it always adds @{} at the beginning and at the end, but you will still have to remember it when adding \multicolumn commands. \documentclass{article} \...


1

I set blocks equal to the width of “channels” with the usual padding on either side but divided by three. We need three blocks for the first column and 12 for the other columns. Some computations are needed for taking care of the vertical rules that take some small, but not negligible, space. The idea is not so difficult: in every row (the first column is ...


2

I recently came across a new package nicematrix that seems to solve most of the common problems that a normal user encounters when trying to setup a simple table. From the manual: In the environments of nicematrix, it’s possible to use the command \Block in order to place an element in the center of a rectangle of merged cells of the array. The command \...


2

You're defeating S columns if you use {} around the data. However, here S columns can't be used, because it's not possible to do computations with the entries. It could be a nice feature, though. You can emulate the working using collcell and expl3 features. Load xparse if your LaTeX system is not up-to-date. \documentclass{article} \usepackage[margin=25mm]{...


1

Like this? Instead of tabularx I suggest to use tabular* and calculation \tabcolsep leave to macro @{\extracolsep{\fill}}. Also you need to correct D column format. It seems, that you use the second caption as notes to table. If this is the case, than you need for desired formatting load caption package too: \documentclass{article} \usepackage{dcolumn} \...


0

This is an edit I would do in my text editor, I use vim :%s/\d.\(\d\d\)\(\d\)\d/\% \1\.\2/gc Should do it. It will ask you before each change it makes. If you want it to change them all without asking further, just remove the c at the end. so, that matches a digit (your 0) a period, captures two digits, captures one digit, matches the final digit. Then it ...


0

You can add an empty line with all cells and a phantom letter: \documentclass{article} \usepackage{multirow} \newcommand{\mc}[2]{\multicolumn{#1}{c|}{#2}} \newcommand{\ec}{\multicolumn{1}{c}{\phantom{W}}} \usepackage{lipsum} \begin{document} \lipsum[47] \begin{table}[!h] \centering \begin{tabular}{|r|*{12}{c}} \ec & \ec &...


0

Hey guys and @leandriis, I could manage to solve my problems by myself. Here is what the final code looks like....just in case you are interested: It includes a way: to solve the prob with white thin vertical lines between the color filled cells by using @leandriis code in this thread above to only change the row height of the first row by using \...


2

You wrote, Is there a way to make tables be counted and named as quadros and have a combined list of quadros? I don't have any tables in my doc, just quadros. So if I could just have all of these floats be called the same and counted as the same it'd be perfect! Since your document doesn't feature table floats that need to be kept separate from quadro ...


0

Follows a solution used for a paper about a neural network based classifier. In the example, there are 5 classes and the confusion matrix is a good way to illustrate the network performance. The tikz code is not universal, but it accepts easily some customization. \documentclass[tikz]{standalone} \usepackage{ifthen} \usetikzlibrary{matrix,calc} \begin{...


0

With \multirow, you have to provide the number of lines of text (which is not exactly the number of rows of the tabular). With {NiceTabular} of nicematrix you have a command \Block and, for that command, you give in as argument the numbers of rows of the tabular and the content is drawn mathematically at the center of the rectangle of merged cells (\Block ...


0

Here is a first rough version of your table that now fits into the textwidth. \documentclass[a4paper,12pt, toc = sectionentrywithdots]{scrartcl} \usepackage[onehalfspacing]{setspace} \usepackage[hmargin={3cm,2cm},vmargin=2cm, includehead]{geometry} \usepackage[scaled=0.9]{helvet} \renewcommand{\familydefault}{\sfdefault} \usepackage[T1]{fontenc} \usepackage[...


1

You can solve your probem with cellspace, which enables you to defines a minimal vertical spacing at the top and bottom of cells in columns with specifier prefixed with the letter S (or C if you load siunitx). \documentclass[11pt, a4paper, notitlepage]{article} \usepackage{array} \usepackage{multirow}% \usepackage{cellspace} \setlength{\cellspacetoplimit}{...


0

You need to shift multirow cell slightly down, for example with use decimal number of text lines in spanned rows: \multirow{4.4}{*}{\thead{Temperature\\ ($\si{\celsius} \pm\SI{0.1}{\celsius}$)}} Complete MWE: \documentclass{article} \usepackage{geometry} \geometry{margin=120pt} %\usepackage{textcomp,gensymb} \usepackage{siunitx} \usepackage{makecell, ...


1

With use of makecell for adding vertical spaces around cells' contents and reducing lines spread in the first columns by use of \linespread{0.6}\selectfont: Writing values in cells I left to you. \documentclass[11pt, a4paper, notitlepage]{article} \usepackage{array, makecell, multirow} \usepackage{siunitx} \begin{document} \begin{table}[ht] \...


0

You can use\cmidrule from booktabs, which can use a trimming argument, like this: \documentclass[a4paper,11pt]{article} \usepackage[margin=2.5cm]{geometry} \usepackage[shorthands=off, bidi=basic, english, ngerman]{babel}% \usepackage[table]{xcolor} \usepackage{booktabs} \usepackage{xltabular} % for tables with long lines & long tables (over >1 page) \...


0

Something like this? \documentclass{article} \usepackage[swedish]{babel} \usepackage{graphicx,array,multirow} \usepackage{mhchem} % for '\ce' macro, for chemical compounts \usepackage{letterspace} % for '\textls' macro \usepackage[output-decimal-marker={,}]{siunitx} % for 'S' column type \begin{document} \begin{table}[ht!] \setlength\extrarowheight{...


2

Always it is necessary insert to table all ampersands: n-1 if you have n columns. Adding missed ampersands in the last two rows -- there are missed three &, will solve your problem. However, your table can be done nicer (at least to my opinion), if you consider in it design packages siunitx, mhchem and makecell and for caption caption: \begin{table}[...


3

The xcoffins package was conceived to place stuff on a page specifying the relative positions with each other, and where in the page. In this case you want a table and a figure stacked vertically and treated as a single element. In this solution there are 4 coffins (boxes with handles) defined, one for the table, a second for the figure and the last two for ...


3

Use caption's \captionof{<float type>}: \documentclass[oneside,11pt]{book} \usepackage[semibold,tt=false]{libertine} \usepackage{libertinust1math} \usepackage[font={sf,small},labelsep=quad,labelfont=sc]{caption} \usepackage[subrefformat=parens]{subcaption} \usepackage[ expansion = false , tracking = smallcaps , letterspace = 40 , ]{microtype} \...


0

Here's a prototype of what I understand you would like to do. From your code I kept only the essential parts. The solution is based on the xcoffin package https://ctan.org/pkg/xcoffins?lang=en that allow you to put material into boxes \SetVerticalCoffin and then precisely join them together. \JoinCoffins The defined command \JoinAndPrintRow joins 4 ...


0

Here is a first rough version of how you could combine all three tables into one: \documentclass[jou]{apa6} %Packages \usepackage[american]{babel} \usepackage{hyperref} \usepackage[inline, shortlabels]{enumitem} \usepackage{amsmath} \usepackage{graphicx} \graphicspath{{Graphics/}} \usepackage{caption, subcaption} \usepackage{array} \...


0

Like this? (red lines indicate page layout) from your document example I try to make MWE (Minimal Working Example),therefore from your example are removed all packages and settings not related to your problem to old version of packages or even deprecated are indicated and replaced with recent one for table is used tabularx environment, its width is set to \...


0

With {NiceTabular*} of nicematrix. \documentclass{article} \usepackage{nicematrix} \usepackage{enumitem} \begin{document} \newcolumntype{-}{@{\extracolsep{\fill}}} \begin{table} \caption{Caption of my table\tabularnote{A tabular note.}} \begin{NiceTabular*}{\textwidth}{c-c-c-c-c}% [code-before = \rowcolor{lightgray}{1}] Col 1 & Col 2 & Col 3 &...


3

Here is a version with {NiceArray} of nicematrix. This package provides two keys cell-space-top-limit and cell-space-bottom-limit (similar to the commands \cellspacetoplimit and \cellspacebottomlimit of cellspace). \documentclass[12pt]{article} \usepackage[a4paper, top = 0.1cm, left = 0.1cm, right = 0.1cm, bottom = 0.1cm, bindingoffset=0cm]{geometry} \...


6

Maybe you want to consider tikzpeople package to draw this kind of schemes \documentclass[tikz,border=3mm]{standalone} \usetikzlibrary{positioning} \usepackage{tikzpeople} \begin{document} \begin{tikzpicture}[mylabel/.style={text width=8 mm, align=center}] \node[bob, minimum width=1.5cm, label={[mylabel, anchor=west]north east:{Public\\ n, e}}, ...


1

Using @Roland answer as starting point (as OP MWE) and employ relative positioning of image elements: \documentclass[tikz, margin=3mm]{standalone} \usetikzlibrary{arrows.meta, calc, fit, positioning, quotes} \begin{document} \begin{tikzpicture}[ node distance = 3mm and 1mm, B/.style = {...


6

I would get rid of all vertical and almost all horizontal rules, left-align the cell contents, use array instead of tabular, double the value of \arraycolsep, and use the \addlinespace macro to create whitespace-type ("negative space") between the rows. I'd also clean up and streamline the LaTeX code; e.g., replace \overline with \bar, use an ...


Top 50 recent answers are included