Comments in LaTeX break pandoc table - latex

Pandoc is unable to convert LaTeX tables with an "% END" comment:
\documentclass{article}
\begin{document}
\begin{table}[h]
\centering
\begin{tabular}{|l|l|l|}
a & a & a \\
a & a & a \\
a & a & a \\
% END
\end{tabular}
\caption{example}
\label{tab:example}
\end{table}
\end{document}
The same example without the comment works fine.

Related

Overfull \hbox and Package array Errors. Latex tabular

I am getting trouble to fit my table - tabular to the paragraph width.
This is the error:
Overfull \hbox (341.06795pt too wide) in paragraph at lines 391--411
Package array Error: Illegal pream-token (M): `c' used.
Package array Error: Illegal pream-token (4cm): `c' used
I have been trying one thousand things and nothing seems to work.
I am using this template from Overleaf, where you can find the document class.
This is my code.
\documentclass{JASSS}
\usepackage{amsmath,systeme}
\usepackage{tabularx,colortbl}
\usepackage{booktabs}
\title{XXXXX}
\reviewcopy{true}
\author[1]{}
\affil[1]{}
\email{XX}
\usepackage{natbib}
\setcitestyle{authoryear,round,aysep={}}
\begin{document}
\maketitle
\begin{abstract}
Bla bla
\end{abstract}
\section{xxxx}
\begin{table}[h!]
\centering
\begin{tabular}{ |M{4cm}||M{4cm}|M{4cm}|M{4cm}|}
% \begin{tabular}{|c|c|c|c|}
\cline{2-4}
\multicolumn{1}{c|}{} & \multicolumn{3}{c|}{Initial value parameter combinations ($t_0=1932$)} \\
\hline
Scenarios from 2020 & $\phi_{B}=\phi_{C}=0.05$ and 1932 electoral results & $\phi_{B}=0.05, \phi_{C}=0.055$ and 1932 electoral results & $\phi_{B}=\phi_{C}=0.05$ and electoral tie \\
\hline
$\phi_{D}=\phi_{E}=0.01$, $\gamma_{B}=\gamma_{C}=\gamma_{D}=\gamma_{E}=0.01$ & S0000 & S0100 & S1000 \\
\hline
\rowcolor{blue!20}
$\phi_{D}=0.015,\phi_{E}=0.01$, $\gamma_{B}=\gamma_{C}=\gamma_{D}=\gamma_{E}=0.01$ & S0001 & S0101 & S1001 \\
\hline
\rowcolor{red!20}
$\phi_{D}=0.01,\phi_{E}=0.015$, $\gamma_{B}=\gamma_{C}=\gamma_{D}=\gamma_{E}=0.01$ & S0010 & S0110 & S1010 \\
\hline
\rowcolor{yellow!20}
$\phi_{D}=0.01,\phi_{E}=0.01$, $\gamma_{B}=\gamma_{C}=\gamma_{D}=\gamma_{E}=0.015$ & S0011 & S0111 & S1011 \\
\hline
\end{tabular}
\bibliographystyle{jasss}
\bibliography{references}
\end{document}
The M column type is not defined by default. If you want to use it, you have to somehow define it. I don't know what you indent it to do, but here some dummy code:
\documentclass{JASSS}
\usepackage{array}
\usepackage{amsmath,systeme}
\usepackage{tabularx,colortbl}
\usepackage{booktabs}
\newcolumntype{M}[1]{p{#1}}
\begin{document}
\begin{table}[h!]
\centering
\begin{tabular}{ |M{4cm}||M{4cm}|M{4cm}|M{4cm}|}
% \begin{tabular}{|c|c|c|c|}
\cline{2-4}
\multicolumn{1}{c|}{} & \multicolumn{3}{c|}{Initial value parameter combinations ($t_0=1932$)} \\
\hline
Scenarios from 2020 & $\phi_{B}=\phi_{C}=0.05$ and 1932 electoral results & $\phi_{B}=0.05, \phi_{C}=0.055$ and 1932 electoral results & $\phi_{B}=\phi_{C}=0.05$ and electoral tie \\
\hline
$\phi_{D}=\phi_{E}=0.01$, $\gamma_{B}=\gamma_{C}=\gamma_{D}=\gamma_{E}=0.01$ & S0000 & S0100 & S1000 \\
\hline
\rowcolor{blue!20}
$\phi_{D}=0.015,\phi_{E}=0.01$, $\gamma_{B}=\gamma_{C}=\gamma_{D}=\gamma_{E}=0.01$ & S0001 & S0101 & S1001 \\
\hline
\rowcolor{red!20}
$\phi_{D}=0.01,\phi_{E}=0.015$, $\gamma_{B}=\gamma_{C}=\gamma_{D}=\gamma_{E}=0.01$ & S0010 & S0110 & S1010 \\
\hline
\rowcolor{yellow!20}
$\phi_{D}=0.01,\phi_{E}=0.01$, $\gamma_{B}=\gamma_{C}=\gamma_{D}=\gamma_{E}=0.015$ & S0011 & S0111 & S1011 \\
\hline
\end{tabular}
\end{table}
\end{document}

How to decrease header level in Overleaf for table of figures + tables?

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}

LaTeX booktabs horizontal oveflow

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}

Making a letter head for certificate page of thesis

I am trying to make a letter head to make a certificate to put in a thesis. I have posted the MWE below.
There are 2 issues I need help with
The cell alignment of the letterhead, is not proper. I am not sure how to correct it.
I need the double lines to be in red colour, I wasn't able to get it.
The final output should be something like this image
enter image description here
\documentclass[12 pt,a4 paper]{article}
\usepackage[top=1cm,left=1in,right=1 in,bottom=1in]{geometry}
\usepackage{times}
\usepackage{graphicx}
\usepackage{marvosym}
\usepackage[onehalfspacing]{setspace}
\usepackage{tikz}
\usetikzlibrary{calc}
\usepackage{fancyhdr}
\usepackage{xcolor}
\pagestyle{fancy}
\usepackage{multirow}
\fancyhf{}
\noindent
\makebox[0pt][l]{\rule[.7ex]{\linewidth}{#1}}%
\rule[.3ex]{\linewidth}{#1}}
\begin{document}
\pagestyle{empty}
\vspace{12 mm}
\begin{tabular}{c c c}
\multicolumn{1}{r}{{\Large Bangalore}} & \multirow{1}{*}{\includegraphics[width=0.175\linewidth]{BUB_Emblem}} & \multicolumn{1}{l}{{\Large University}}\\
%\multicolumn{1}{r}{\Huge{Bangalore}} & \multirow{1}{*}{\includegraphics[width=0.15\linewidth]{BUB_Emblem}} & \multicolumn{1}{l}{\Huge{University}}\\
\large{Dr Vijaykumar H Doddamani} & & \multicolumn{1}{l}{Department of Physics} \\
\multicolumn{1}{r}{M.Sc., M. Phil., PhD} && \multicolumn{1}{l}{Ph. Off: 080-22961471/84} \\
&&\multicolumn{1}{l}{Fax: 080-23219295}\\
\multicolumn{1}{l}{\textbf{\large Professor}} & & \multicolumn{1}{l}{Mobile : 9481300346} \\
\multicolumn{1}{l}{Email: drvkd#gmail.com} & Jnanabharathi Campus & \multicolumn{1}{l}{Mobile : 9448673274} \\
\multicolumn{1}{r}{profvijaykumarhd#bub.ernet.in} & Bengaluru - 560 056 & \multicolumn{1}{l}{WhatsApp :9741716744} \\
%
\end{tabular}
\vskip2mm
\vspace{2mm}
\doublerule[1pt]
\end{document}
With this code, This is the output I am getting.
enter image description here
I have put in the arrows and comments in this imagearrows and comments for width alinment
\documentclass[12 pt,a4 paper]{article}
\usepackage[top=1cm,left=1in,right=1 in,bottom=1in]{geometry}
\usepackage[table]{xcolor}
\usepackage{times}
\usepackage{graphicx}
\usepackage{marvosym}
\usepackage[onehalfspacing]{setspace}
\usepackage{tikz}
\usetikzlibrary{calc}
\usepackage{fancyhdr}
\pagestyle{fancy}
\usepackage{multirow}
\fancyhf{}
\newcommand{\doublerule}[1][.4pt]{%
\noindent%
\makebox[0pt][l]{\rule[.7ex]{\linewidth}{#1}}%
\rule[.3ex]{\linewidth}{#1}}
\begin{document}
\pagestyle{empty}
\vspace{12 mm}
\centerline{%
\makebox[\paperwidth]{%
\begin{tabular}{#{\hspace{.08\paperwidth}} p{.32\paperwidth} p{.2\paperwidth} p{.32\paperwidth} #{\hspace{.08\paperwidth}} }
\multicolumn{1}{#{}r#{}}{\Large Bangalore} & \centering\multirow{1}{*}{\includegraphics[width=.9\linewidth]{example-image-duck}} & \Large University\\
\multicolumn{1}{#{}r#{}}{\large Dr Vijaykumar H Doddamani} & & Department of Physics\\
\multicolumn{1}{#{}r#{}}{M.Sc., M. Phil., PhD} && Ph. Off: 080-22961471/84 \\
&&Fax: 080-23219295\\
\textbf{\large Professor} & & Mobile : 9481300346 \\
Email: drvkd#gmail.com & \centering Jnanabharathi Campus & Mobile : 9448673274 \\
\hphantom{Email:} profvijaykumarhd#bub.ernet.in & \centering Bengaluru - 560 056 & WhatsApp :9741716744 \\[2mm]
\arrayrulecolor{red}\hline\hline
\end{tabular}%
}}
\end{document}

Equation error in Latex table

I'd like to create a table with two parameters and the corresponding equation.
Somehow Latex gives me the error:
'! Missing $ inserted.'
and I don't know what that means...
\begin{table}[H]
\centering
\caption{XXX}
\label{tab:XXX}
\begin{adjustbox}{max width=\textwidth}
\begin{tabular}{c c}
\hline\hline
\vspace{0.25cm}
Parameter & Mathematical Equation \\ \hline
\vspace{0.25cm}
Standard Deviation & \sigma=\sqrt{\frac{\sum(X-\mu)$^2$}{N}} \\
\vspace{0.25cm}
Variance & \sigma^2=\frac{\sum(X-\mu)$^2$}}{N} \\
\\ \hline
\end{tabular}
\end{adjustbox}
\end{table}
In TeX, $ signs enclose inline math code (see here). Your example already uses it around ^2. However, you also use other macros that are only valid inside a math environment, such as e.g. \sigma. Hence, you should surround all macros that require math mode with $ signs:
\begin{table}[H]
\centering
\caption{XXX}
\label{tab:XXX}
\begin{adjustbox}{max width=\textwidth}
\begin{tabular}{c c}
\hline\hline
\vspace{0.25cm}
Parameter & Mathematical Equation \\ \hline
\vspace{0.25cm}
Standard Deviation & $\sigma=\sqrt{\frac{\sum(X-\mu)^2}{N}}$ \\
\vspace{0.25cm}
Variance & $\sigma^2=\frac{\sum(X-\mu)^2}{N}$ \\
\\ \hline
\end{tabular}
\end{adjustbox}
\end{table}
If you prefer not to mix TeX and LaTeX commands, consider using \(...\) instead of $...$.

Resources