Many years I've successfully used the tabu-package to create tables like shown in the code-example below. I produced an extended number of those tables in an documentation and so want to avoid major changes.
Since the June update of MiKTeX to Version 21.6 all the tables show the same error-message like:
Row xx Dimension too large. \end{longtabu}
As soon as I use one of the previous MiKTeX Version e.g. 21.3. proper tables are produced.
Are there any ideas what the reason could be and how to circumnavigate the problem?
My code:
\documentclass[10pt,a4paper]{article}
\usepackage[latin1]{inputenc}
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{amssymb}
\usepackage{array}
\usepackage{graphicx}
\usepackage{setspace}
\usepackage{longtable}
\usepackage{tabu}
\begin{document}
\begin{spacing}{2}
\begin{longtabu}to\textwidth{lXl}
200 A & & 300 B \\
100 C & & 200 D \\
30 E & & 600 F \\
80 G & & 50 H \\
0,5 I & &3000 J \\
\end{longtabu}
\end{spacing}
\end{document}
Related
\documentclass{article}
\usepackage{makecell,multirow,tabularx}
\usepackage{graphicx}
\usepackage{xcolor,colortbl}
\usepackage{booktabs}
\usepackage[includefoot,margin=0.30in,headsep=0.0in,bottom=2.3in]{geometry}
\setlength{\headheight}{110pt}
\usepackage{fancyhdr}
\pagestyle{fancy}
\renewcommand{\headrulewidth}{0pt}
\definecolor{tamu}{HTML}{500000}
\definecolor{lightgray}{HTML}{e9e7e8}
\usepackage{nicematrix}
\usepackage{booktabs}
\fancyhead[C]{
\begin{NiceTabularX}{\textwidth}{| l | X | l |}[rules/color=tamu,rules/width=1mm]
\CodeBefore
\rowlistcolors{1}{red!15}
\Body
\toprule[1mm]
Experiment Number & Experiment & Date \\[5pt]
& & \qquad / \qquad / \qquad\qquad\qquad \\[5pt]
\midrule[1mm]
Name & Lab Partners & CRN \\[5pt]
& & \\[5pt]
\bottomrule[1mm]
\end{NiceTabularX}
}
\fancyfoot[c]{
\begin{NiceTabularX}{\textwidth}{| X | X | X | X |}[rules/color=tamu,rules/width=1mm]
\CodeBefore
\rowlistcolors{1}{red!15}
\Body
\midrule[1mm]
Signature & Date & TA & Date \\[5pt]
&\qquad\qquad / \qquad\qquad / \qquad\qquad & & \qquad\qquad / \qquad\qquad / \qquad\qquad \\[5pt]
\bottomrule[1mm]
\end{NiceTabularX}
}
\usepackage[T1]{fontenc}
\usepackage[most]{tcolorbox}
\usepackage{lmodern}
\usepackage{lipsum}
\begin{document}
\begin{tcolorbox}[enhanced,fit to height=8.25in,colframe=tamu,arc=0pt,outer arc=0pt,boxrule=1mm]
\end{tcolorbox}
\end{document}
The output of this code makes a 2 paged pdf, but I only want the second page. The first page is unneeded and I was wondering what I'm doing wrong since I think its making a second page since its overflowing, but I am not sure. I think the way I'm making the footer is a bit weird, but maybe I am doing it right, please let me know.
Output (Page 1):
Output (Page 2):
Also, if anyone can answer this I would be very happy. I have no clue why, but the borders seem to be drawn too far? What I mean is the top of the borders and maybe some other spots in the header and maybe footer are too long/bleed over where they should (see image below).
Weird borders:
If you'll look into the .log file, you'll find the following warning
Overfull \vbox (19.15993pt too high) has occurred while \output is active []
This warning is caused by the tcolorbox which is taller than the available space on this page. Latex tries to fix this by moving it to the next page, hoping that if it'll be the very first thing on the page, it might fit.
You can avoid this by making your box a bit smaller, so that it's height is smaller (or equal) to the \textheight:
\documentclass{article}
\usepackage{makecell,multirow,tabularx}
\usepackage{graphicx}
\usepackage{xcolor,colortbl}
\usepackage{booktabs}
\usepackage[includefoot,margin=0.30in,headsep=0.0in,bottom=2.3in,showframe]{geometry}
\setlength{\headheight}{110pt}
\usepackage{fancyhdr}
\pagestyle{fancy}
\renewcommand{\headrulewidth}{0pt}
\definecolor{tamu}{HTML}{500000}
\definecolor{lightgray}{HTML}{e9e7e8}
\usepackage{nicematrix}
\usepackage{booktabs}
\fancyhead[C]{
\begin{NiceTabularX}{\textwidth}{| l | X | l |}[rules/color=tamu,rules/width=1mm]
\CodeBefore
\rowlistcolors{1}{red!15}
\Body
\toprule[1mm]
Experiment Number & Experiment & Date \\[5pt]
& & \qquad / \qquad / \qquad\qquad\qquad \\[5pt]
\midrule[1mm]
Name & Lab Partners & CRN \\[5pt]
& & \\[5pt]
\bottomrule[1mm]
\end{NiceTabularX}
}
\fancyfoot[c]{
\begin{NiceTabularX}{\textwidth}{| X | X | X | X |}[rules/color=tamu,rules/width=1mm]
\CodeBefore
\rowlistcolors{1}{red!15}
\Body
\midrule[1mm]
Signature & Date & TA & Date \\[5pt]
&\qquad\qquad / \qquad\qquad / \qquad\qquad & & \qquad\qquad / \qquad\qquad / \qquad\qquad \\[5pt]
\bottomrule[1mm]
\end{NiceTabularX}
}
\usepackage[T1]{fontenc}
\usepackage[most]{tcolorbox}
\usepackage{lmodern}
\usepackage{lipsum}
\begin{document}
\begin{tcolorbox}[enhanced,fit to height=\textheight,colframe=tamu,arc=0pt,outer arc=0pt,boxrule=1mm]
\end{tcolorbox}
\end{document}
I am trying to output a LaTex file using Stata's esttab command. I cannot get the decimals to align, nor can I get the nice formatting from the "booktabs" option to work. I also would like to increase the width of the columns. I have been tinkering with this for hours and have had no luck. Below is my Stata code and the LaTex code that I am running through Overleaf. Any help would be greatly appreciated!
Here is my Stata code:
#delimit ;
esttab r1 r2 r3 r4 using "C:\Users\user\Dropbox\Private
Code\Code\STATA\latex\table1.tex", replace
b(3) nomtitle label star(* 0.10 ** 0.05 *** 0.01)
booktabs alignment(D{.}{.}{-1})
title(Placeholder)
s(N DAY FFE FIRM_QUARTER r2_a,
fmt(%9.0fc 0 0 0 3)
label("Observations" "Day FE" "Firm FE" "Firm-Quarter FE" "Adj. R-Sq{\super 2}"))
compress nocons;
Here is the LaTex code it spits out:
\begin{table}[htbp]\centering
\def\sym#1{\ifmmode^{#1}\else\(^{#1}\)\fi}
\caption{Placeholder}
\begin{tabular}{l*{4}{D{.}{.}{-1}}}
\toprule
&\multicolumn{1}{c}{(1)} &\multicolumn{1}{c}{(2)} &\multicolumn{1}
{c}{(3)} &\multicolumn{1}{c}{(4)} \\
\midrule
VAR1 & 0.007\sym{***}& 0.007\sym{***}& 0.006\sym{***}& 0.007\sym{***}\\
& (8.55) & (7.82) & (7.67) & (8.54) \\
\addlinespace
VAR2 & 0.132\sym{***}& 0.131\sym{***}& 0.131\sym{***}& 0.132\sym{***}\\
& (20.35) & (20.15) & (20.15) & (20.35) \\
\midrule
Observations &1,315,077 &1,315,077 &1,315,077 &1,315,077
\\
Day FE & No & Yes & Yes & No \\
Firm FE & Yes & No & Yes & No \\
Firm-Quarter FE & No & No & No & Yes \\
Adj. R-Sq{\super 2}& 0.045 & 0.027 & 0.046 & 0.044
\\
\bottomrule
\multicolumn{5}{l}{\footnotesize \textit{t} statistics in parentheses}\\
\multicolumn{5}{l}{\footnotesize \sym{*} \(p<0.10\), \sym{**} \(p<0.05\), \sym{***} \(
p<0.01\)}\\
\end{tabular}
\end{table}
Since you haven't provided the full code, I can't see what would your output be. When I add \documentclass{article} with missing packages in a preamble, I get very wide table which does not fit a page. Also, I don't know whether the code is automatically generated or created/altered by you.
Assuming the latter, I would do the following. Since you add footnotes in the table, I would enclose tabular within threeparttable, which splits the area for table into three parts: top for captions, middle for a table definition e.g. tabular, and bottom part for footnotes. It also adds a convenient macro \tnote{}.
Secondly, dcolumn causes big numbers to be pushed way too much to the left. You should let dcolumn suppress their alignment. I personally don't know how, although I assume there is a way.
I prefer siunitx for formatting numbers in tables. However siunitx needs a bit more work. It automatically parses numbers in cells and any non-number content generates errors. Therefore, non-numbers need to be enclosed within {...} which instructs siunitx to leave the content intact. It also forces numbers not to be formatted, aligned etc., which is what I did for the big numbers you have in the table. There's also option to format thousands and millions with any separator of your choice. For instance you could use one of the macros: \,, :, or \; for thin, mid or thick space, respectively instead of ,.
Below is my suggestion for your table based on siunitx and threeparttable, so you can compare it with your approach.
\documentclass{article}
\usepackage{array}
\usepackage{booktabs}
\usepackage{siunitx}
\usepackage{threeparttable}
\newcommand\super[1]{\textsuperscript{#1}}
\sisetup{
group-separator={,},
table-format=1.3,
table-align-text-after = false,
}
\begin{document}
\begin{table}[htbp]
\def\sym#1{\ifmmode^{#1}\else\(^{#1}\)\fi}
\centering
\begin{threeparttable}
\caption{Placeholder}
\begin{tabular}{l *{4}{S}}
\toprule
& \multicolumn{1}{c}{(1)}
& \multicolumn{1}{c}{(2)}
& \multicolumn{1}{c}{(3)}
& \multicolumn{1}{c}{(4)} \\
\midrule
{VAR1} & 0.007\tnote{***} & 0.007\tnote{***} & 0.006\tnote{***} & 0.007\tnote{***} \\
& {(8.55)} & {(7.82)} & {(7.67)} & {(8.54)} \\
\addlinespace
VAR2 & 0.132\tnote{***} & 0.131\tnote{***} & 0.131\tnote{***} & 0.132\tnote{***} \\
& {(20.35)} & {(20.15)} & {(20.15)} & {(20.35)} \\
\midrule
Observations
& \multicolumn{1}{c}{\num{1315077}}
& \multicolumn{1}{c}{\num{1315077}}
& \multicolumn{1}{c}{\num{1315077}}
& \multicolumn{1}{c}{\num{1315077}} \\
Day FE & {No} & {Yes} & {Yes} & {No} \\
Firm FE & {Yes} & {No} & {Yes} & {No} \\
Firm-Quarter FE & {No} & {No} & {No} & {Yes} \\
Adj. R-Sq{\super2} & 0.045 & 0.027 & 0.046 & 0.044 \\
\bottomrule
\end{tabular}
\par\(t\) statistics in parentheses
\par\tnote{*} \(p < 0.10\),\quad\tnote{**} \(p < 0.05\),\quad\tnote{***} \(p < 0.01\)
\end{threeparttable}
\end{table}
\end{document}
EDIT. I also enclosed statistics in{...} because siunitx does not recognised brackets as part of a number.
I'm trying to figure out how to change my list of figures and tables so it refers to figures and tables on a section level. My document type is article in overleaf.
My current code looks as follows:
\documentclass{article}
\begin{document}
\maketitle
\section{Abstract}
\newpage
\tableofcontents
\newpage
\addcontentsline{toc}{section}{\listfigurename}
\listoffigures
\newpage
\addcontentsline{toc}{section}{\listtablename}
\listoftables
\newpage
\section{Introduction}
\section{3}
\section{4}
\begin{table}[H]
\renewcommand{\arraystretch}{2}
\centering
\begin{tabular}{ p{6cm}p{6cm}}
\toprule
\textbf{Variables} & \textbf{Description} \\ \midrule
\textit{F\_27608, R\_27730} & The amount of cheese and yogurt ordered weekly. \\
\textit{Year} & Year of the observation. \\
\textit{Winter, Spring, Summer, Autumn} & Season of the observation. \\
\textit{Week} & Week of the observation. \\
\textit{Lag1, Lag2, Lag3, Lag4, Lag5} & Lagged order amounts for prior periods. \\
\textit{Price} & Mean price of the product for the specific observation. \\
\textit{Fut1, Fut2, Fut3, Fut4, Fut5} & Future price of the product. \\
\textit{PromoScale} & Level of expected increase in orders caused by promotion. \\
\textit{PromoScale(L1, L2, L3)} & Lagged PromoScale values for prior periods \\
\textit{PromoScale(F1, F2, F3)} & Future PromosSale values. \\ \bottomrule
\end{tabular}
\caption{Feature space cheese and yogurt}
\end{table}
See picture:
List of tables
How do i make it so that these tables say 4.1 and 4.2 in the list of tables? (the code only shows one table for reference)
You can use \counterwithin{figure}{section} to number a counter within a section:
\documentclass{article}
\counterwithin{figure}{section}
\counterwithin{table}{section}
\begin{document}
\section{Abstract}
\newpage
\tableofcontents
\newpage
\addcontentsline{toc}{section}{\listfigurename}
\listoffigures
\newpage
\addcontentsline{toc}{section}{\listtablename}
\listoftables
\newpage
\section{Introduction}
\section{3}
\section{4}
\begin{table}[htbp]
\caption{Feature space cheese and yogurt}
\end{table}
\end{document}
I am writing a paper in APS journal template : revtex4-2, when I import my table I have this error :
Missing control sequence inserted. \end{tabulary}. But this table has no problem in other template for example IEEE. I dont know how fix it. I really appreciate any help.
\documentclass[aps,pra,twocolumn,floatfix,footinbib,notitlepage,superscriptaddress,groupaddress,showpacs]{revtex4-2}
\usepackage{graphicx,graphics,times,bm,bbm,bbold,amssymb,amsmath,amsfonts,dsfont,hyperref,mathrsfs,color,caption,subcaption,cancel}
\usepackage{adjustbox}
\usepackage{tabularx}
\usepackage{tabulary}
\usepackage{graphicx}% Include figure files
\usepackage{dcolumn}% Align table columns on decimal point
\usepackage{bm}
\begin{document}
\preprint{AIP/123-QED}
%\title[Sample title]{Sample Title:\\with Forced Linebreak\footnote{Error!}}% Force line breaks with \\
\title[]
\author{}
\affiliation{}
\author{}
\affiliation{}
\email{}
\date{\today}
\begin{abstract}
\end{abstract}
% \keywords{}
% \maketitle
\section{Introduction}\label{sec:introduction}
\section{Theoretical Analysis}
\begin{table}[h!]
\centering
\caption{List of Parameters Values }
\label{table:1}
\begin{adjustbox}{max width=8.5 cm}
\begin{tabulary}{\columnwidth}{#{}llr#{}}
\toprule
\textbf{Parameters} & \textbf{Values} & \textbf{Units}\\
\midrule
$\lambda$ & 1550 & $nm$ \\
\bottomrule
\end{tabulary}
\end{adjustbox}
\end{table}.
\end{document}
%
% ****** End of file aipsamp.tex ******
I suggest the new and much more flexible tabularray package instead.
Also don't scale content which contains text, this will result in an suboptimal result. If in your real document, you must make the table smaller, use a smaller font size instead of scaling it with adjustbox.
(you should really clean up your preamble and remove duplicates and outdated packages)
\documentclass[aps,pra,twocolumn,floatfix,footinbib,notitlepage,superscriptaddress,groupaddress,showpacs]{revtex4-2}
\usepackage{graphicx,graphics,times,bm,bbm,bbold,amssymb,amsmath,amsfonts,dsfont,hyperref,mathrsfs,color,caption,subcaption,cancel}
\usepackage{adjustbox}
\usepackage{tabularx}
\usepackage{tabulary}
\usepackage{graphicx}% Include figure files
\usepackage{dcolumn}% Align table columns on decimal point
\usepackage{bm}
\usepackage{tabularray}
\UseTblrLibrary{booktabs}
\begin{document}
\preprint{AIP/123-QED}
%\title[Sample title]{Sample Title:\\with Forced Linebreak\footnote{Error!}}% Force line breaks with \\
\title[]
\author{}
\affiliation{}
\author{}
\affiliation{}
\email{}
\date{\today}
\begin{abstract}
\end{abstract}
% \keywords{}
% \maketitle
\section{Introduction}\label{sec:introduction}
\section{Theoretical Analysis}
\begin{table}[h!]
\centering
\caption{List of Parameters Values }
\label{table:1}
% \begin{adjustbox}{max width=8.5 cm}
\begin{tblr}{width=0.8\linewidth,colspec={#{}X[l]X[l]X[r]#{}}}
\toprule
\textbf{Parameters} & \textbf{Values} & \textbf{Units}\\
\midrule
$\lambda$ & 1550 & $nm$ \\
\bottomrule
\end{tblr}
% \end{adjustbox}
\end{table}
\end{document}
%
% ****** End of file aipsamp.tex ******
I am new to LaTeX and I want to create a quite simple table (in german). As you can see in my code, it has to contain 5 rows and 5 columns. My problem is that the table is too large for my page and it overflows on the right side of the page. I don't want to rotate the table, so it should use hyphenation to use the given space better.
\documentclass[12pt]{article}
\usepackage[ngerman]{babel}
\usepackage[utf8]{inputenc}
\usepackage{color}
\usepackage[a4paper,lmargin={3cm},rmargin={2cm},
tmargin={2cm},bmargin = {2cm}]{geometry}
\usepackage{amssymb}
\usepackage{amsthm}
\usepackage{graphicx}
\usepackage{csquotes}
\usepackage{mathptmx}
\usepackage{booktabs}
\MakeOuterQuote{"}
\linespread{1.5}
\begin{document}
\end{document}
\begin{table}[h]
\centering
\caption{Übersicht aller Umfragen zur Landtagswahl in Sachsen-Anhalt im April/Mai 2021.}
\begin{tabular}{l l l l l}
\toprule
Durchgeführt von:
& Erhebungszeitraum
& Datum der Veröffentlichung
& Erhebungsmethode(n)
& Veröffentlicht von:\\
\midrule
infratest dimap
& 16. – 21.April 2021
& 23.April 2021
& zufallsbasierte Telefon- und Onlineinterviews
& mrd.de \\
Forsa
& 20. – 27.April 2021
& 29.April 2021
& k.A.
& welt.de \\
Insa
& 17. – 23.Mai 2021
& 26.Mai 2021
& k.A.
& bild.de \\
infratest dimap
& 25. – 26.Mai 2021
& 27. Mai 2021
& zufallsbasierte Telefon- und Onlineinterviews
& tagesschau.de \\
Mannheimer Forschungsgruppe Wahlen
& 25. – 27.Mai 2021
& 28.Mai 2021
& zufallsbasierte Telefoninterviews
& zdf.de \\
\bottomrule
\end{tabular}
\end{table}
\end{document}
I think a similar problem is described here, but to be honest; my table is much simpler (no multicolumns and no math-symbols), so I have some problems to find the right code to solve my problem.
Thank you very much for reading my question! :)
To get line breaks you'll need a column type of fixed with, e.g. p{<some width>} or you can use the tabularx package to automatically determine the width of the columns.
However even with line breaks, the table will still look awfully crowded. You can safe a bit more space by giving the months as numbers instead of words and adding #{} before/after the first/last column.
\documentclass[12pt]{article}
\usepackage[ngerman]{babel}
\usepackage[utf8]{inputenc}
\usepackage{color}
\usepackage[a4paper,lmargin={3cm},rmargin={2cm},
tmargin={2cm},bmargin = {2cm}]{geometry}
\usepackage{amssymb}
\usepackage{amsthm}
\usepackage{graphicx}
\usepackage{csquotes}
\usepackage{mathptmx}
\usepackage{booktabs}
\usepackage{tabularx}
\MakeOuterQuote{"}
\linespread{1.5}
\begin{document}
\begin{table}[h]
\centering
\caption{Übersicht aller Umfragen zur Landtagswahl in Sachsen-Anhalt im April/Mai 2021.}
\begin{tabularx}{\linewidth}{#{} *5{>{\raggedright\arraybackslash}X} #{}}
\toprule
Durchgeführt von:
& Erhebungs\-zeitraum
& Datum der Veröffentlichung
& Erhebungs\-methode(n)
& Veröffentlicht von:\\
\midrule
infratest dimap
& 16. – 21.4.2021
& 23.4.2021
& zufallsbasierte Telefon- und Onlineinterviews
& mrd.de \\
Forsa
& 20.–27.4.2021
& 29.4.2021
& k.A.
& welt.de \\
Insa
& 17.–23.5.2021
& 26.5.2021
& k.A.
& bild.de \\
infratest dimap
& 25.–26.5.2021
& 27.5.2021
& zufallsbasierte Telefon- und Onlineinterviews
& tagesschau.de \\
Mannheimer Forschungsgruppe Wahlen
& 25.–27.5.2021
& 28.5.2021
& zufallsbasierte Telefoninterviews
& zdf.de \\
\bottomrule
\end{tabularx}
\end{table}
\end{document}