Is anyone aware of a way to draw something like the following in latex?
I bet tikzpicture can allow to achieve that, but can anyone show me a simple example?
Credit to the author: https://commons.wikimedia.org/wiki/User:Accountalive
Just for fun a version in tikz-cd:
\documentclass{article}
\usepackage{tikz-cd}
\usepackage{mathtools}
\begin{document}
\begin{tikzcd}[
arrow style=tikz,
>={latex}
]
\arrow[rd,shift left] \arrow[rd,<-,shift right,-] & & & & & & \\
& \text{\textbullet} \arrow[rrd,shift left]\arrow[rrd,shift right,<-] \arrow[dd,shift left,"prev(e)",teal] \arrow[dd,shift right,<-] & & & & & \arrow[ld,shift left] \arrow[ld,shift right,-] \\
& & & \text{\textbullet} \arrow[rr,shift left] \arrow[rr,shift right,<-]& & \text{\textbullet} \arrow[ld,shift left]\arrow[ld,shift right,<-,"next(e)",swap,green,near end] & \\
& \text{\textbullet} \arrow[rrr,shift left,"e",blue]\arrow[rrr,shift right,<-,"twin(e)",swap,orange] & & & \text{\textbullet} \arrow[rd,shift left,-]\arrow[rd,shift right,<-] & & \\
& & & & & ~ &
\end{tikzcd}
\end{document}
Related
I'm trying to draw a table, but I faced a problem with the extra column line.
\documentclass[lettersize,journal]{IEEEtran}
\usepackage{array,tabularx}
\usepackage{pifont}
\usepackage{multirow,booktabs,tabu}
\begin{table*}[!t]
\caption{A. \label{table8}}
\centering
\begin{tabu}{|c|c|c|c|c|c|c|}
\hline
\multirow{2}{*}{A} & \multicolumn{2}{c|}{\multirow{2}{*}{B}} & \multicolumn{4}{c|}{C} \\
\cline{4-7}
& & & E & F & G & H \\
\cline{1-7}
\multirow{3}{*}{D} &
\multirow{3}{*}{K} & $1.0612e-09$ & $1.0610e-09$ & $5.2760e-10$ & $3.7844e-08$ & $7.6545e-06 $\\
\cline{3-7}
& & $9.724e-10$ & $9.7239e-10$ & $4.8758e-10$ & $4.9127e-08$ & $7.7153e-06 $\\
\cline{3-7}
& & $9.132e-10$ & $9.131e-10$ & $4.1633e-10$ & $4.3932e-08$ & $8.2672e-06$\\[-1pt]
%\cline{2-7
\hline
\end{tabu}
\end{table*}
Does anyone know how to remove this extra line that shown in
Don't use the tabu package - it is more or less completely broken. The only thing which helds this package together is a lot of ducktape by the latex team.
Instead you could use tabularray package, which makes merging cells much easier and you'll also don't have to worry how long all your lines should be.
You might also want to choose another column type, like S from siunitx, to avoid the incorrect spacing around your minus signs ....
\documentclass[lettersize,journal]{IEEEtran}
\usepackage{array,tabularx}
\usepackage{pifont}
\usepackage{multirow,booktabs,tabularray}
\UseTblrLibrary{siunitx}
\begin{document}
\begin{table*}[!t]
\caption{A. \label{table8}}
\centering
\begin{tblr}{
colspec={|c|c|S[table-format=1.3e-2]|S[table-format=1.3e-2]|S[table-format=1.3e-2]|S[table-format=1.3e-2]|S[table-format=1.3e-2]|},
vlines,
hlines,
row{1-2} = {guard}
}
\SetCell[r=2]{} A & \SetCell[c=2,r=2]{} B && \SetCell[c=4]{} C &&& \\
& & & E & F & G & H \\
\SetCell[r=3]{} D &
\SetCell[r=3]{} K & 1.0612e-09 & 1.0610e-09 & 5.2760e-10 & 3.7844e-08 & 7.6545e-06\\
& & 9.724e-10 & 9.7239e-10 & 4.8758e-10 & 4.9127e-08 & 7.7153e-06\\
& & 9.132e-10 & 9.131e-10 & 4.1633e-10 & 4.3932e-08 & 8.2672e-06\\
\end{tblr}
\end{table*}
\end{document}
I am generating tables in latex. But the text's font is way too small compared to the main text size, which is 12 pt.
Here is the Latex code
\begin{table}[htp]
\renewcommand{\arraystretch}{2}
\large
\resizebox{1\textwidth}{!}{%
\begin{tabular}{|c|c|c|c|c|c|}
\hline
\textbf{Air pollutant} & \textbf{Detection limit} & \textbf{Concentration range to expect
by EPA} & \textbf{Concentration range in Bristol, UK} & \textbf{Range in Bristol, UK} \\[3ex]
\hline
\textbf{Ozone (O$_{3}$) } & \textbf{10 ppb} & \textbf{0--150 ppb }
& \textbf{0--100 ppb} & \\[3ex] \hline
\textbf{Nitrogen dioxide} & \textbf{10 ppb} & \textbf{0--50 ppb}
& \textbf{20--55 ppb} & \\[3ex] \hline
\textbf{PM$_{2.5}$} & \textbf{5 } & \textbf{0--40 \SI{}
{\micro\gram/m^3}} & \textbf{0--40 \SI{}{\micro\gram/m^3} }
& \\[3ex] \hline
\textbf{PM$_{10}$} & \textbf{10} & \textbf{0--100 \SI{}
{\micro\gram/m^3} } & \textbf{0--100 \SI{}{\micro\gram/m^3}}
& \\[3ex] \hline
\textbf{Temperature range} & ----- & ------ & ----
-- & \textbf{3--$ 21 ^\circ C $} \\[3ex]
\hline
\textbf{Humidity } & ----- & ----- & -----
-- & \textbf{50\%--75\% } \\[3ex] \hline
\end{tabular}%
}
\end{table}
and here is a screenshot of part of PDF to compare the main text and table font
I have this issue for several tables, so any help would be greatly appreciated.
Can I suggest a few things?
You should avoid long headings with narrow content like numbers, unless cells contain long paragraphs, as well. Find the way to shorten the headings, e.g. by adding line breaks.
Repeated content can be grouped and move to separate cells, which can also help with excessive widths.
As you load siunitx, I would recommend to use \qtyrange{}{}{}. Typing them takes the same space and time but in case you need to make changes e.g. you have to change a range marker from -- to to you will appreciate to only have to do it in one place via siunitx. If you repeat long units, it is also possible to define your own units, for the same reason to make changes in one place. I think \SI{}{} is deprecated and should be changed to qty{}{}, although I am not entirely sure about it.
This is my personal taste but IMO tables can look much better without vertical bars. I also added booktabs for improved horizontal rules.
Here's a different version of your table
and the code
\documentclass{article}
\usepackage{array}
\usepackage{siunitx}
\usepackage{multirow}
\usepackage{makecell}
\usepackage{rotating}
\usepackage{booktabs}
\sisetup{
range-units=single,
range-phrase={\,--\,},
}
\DeclareSIUnit\ppb{ppb}
\newcommand\nullval{---}
\renewcommand\theadfont{\normalfont\bfseries}
\renewcommand\theadgape{\Gape[0pt][0pt]}
\begin{document}
\begin{sidewaystable}
\renewcommand\arraystretch{1.2}
\caption{Caption of the table}
\label{tab:table}
\centering
\begin{tabular}{
wc{4cm}
wc{2cm} #{\hspace{1em}}
*3{wc{3cm}}
wc{2cm}
}
\toprule
\multirow{3}*{\thead*{Air\\pollutant}}
& \multirow{3}*{\thead{Detection\\limit}}
& \multicolumn{2}{c}{\thead{Concentration range:}}
& \multirow{3}*{\thead{Range\\in Bristol, UK}} \\
\cmidrule(lr){3-4}
& & \thead{to expect\\by EPA} & \thead{in Bristol\\UK} & \\
\midrule
\thead{Ozone (O\textsubscript{3})}
& \qty{10}{\ppb} & \qtyrange{0}{150}{\ppb} & \qtyrange{0}{100}{\ppb} & \nullval \\
\thead{Nitrogen dioxide}
& \qty{10}{\ppb} & \qtyrange{0}{50}{\ppb} & \qtyrange{20}{55}{\ppb} & \nullval \\
\thead{PM\textsubscript{2.5}}
& 5 & \qtyrange{0}{40}{\mg/m^3} & \qtyrange{0}{40}{\ug/m^3} & \nullval \\
\thead{PM\textsubscript{10}}
& 10 & \qtyrange{0}{100}{\ug/m^3} & \qtyrange{0}{100}{\ug/m^3} & \nullval \\
\thead{Temperature range}
& \nullval & \nullval & \nullval & \qtyrange{3}{21}{\degreeCelsius} \\
\thead{Humidity}
& \nullval & \nullval & \nullval & \qtyrange{50}{75}{\%} \\
\bottomrule
\end{tabular}
\end{sidewaystable}
\end{document}
You should never use \resizebox for elements which contain text.
Instead you could save some space by using multiple lines for your header cells and restructure your table a bit:
\documentclass[12pt]{article}
\usepackage[text-series-to-math=true]{siunitx}
\usepackage{tabularray}
\usepackage{geometry}
\begin{document}
\begin{table}[htp]
\caption{... The temperature range in Bristol, UK was 3--\SI{21}{\degree C} and the humidity 50\%--75\% during the measurement.}
\begin{tblr}{
colspec={XXXXX},
columns={halign=c,valign=m},
row{1}={font=\bfseries},
column{1}={font=\bfseries},
stretch=0,
rows={ht=2\baselineskip},
hlines,
vlines
}
Air pollutant & Detection limit & Concentration range to expect
by EPA & Concentration range in Bristol, UK \\
Ozone (O\textsubscript{3}) & 10 ppb & 0--150 ppb & 0--100 ppb \\
Nitrogen dioxide & 10 ppb & 0--50 ppb & 20--55 ppb \\
PM\textsubscript{2.5} & 5 & 0--40 \SI{}{\micro\gram/m^3} & 0--40 \SI{}{\micro\gram/m^3} \\
PM\textsubscript{10} & 10 & 0--100 \SI{}{\micro\gram/m^3} & 0--100 \SI{}{\micro\gram/m^3} \\
\end{tblr}%
\end{table}
\end{document}
I am working with Stata to create a balance table for some data using the balancetable ado package. While I believe the balancetable commands are working, the output LaTeX document won't run the table that it is trying to print. Given that I am still learning how to use LaTeX, any assistance with trying to see what the syntax issue is with this LaTeX code would be much appreciated. I'm getting issues related to the document name, typesetting and compiler issues.
\begin{tabular}{l*{3}c}
\hline\hline
& (1) & (2) & (3) \\
\hline
agesq&677.315&717.395&40.079\\
&(428.784)&(431.252)&(41.341)\\
educ&10.088&10.346&0.257\\
&(1.614)&(2.011)&(0.172)\\
black&0.827&0.843&0.016\\
&(0.379)&(0.365)&(0.036)\\
hisp&0.108&0.059&-0.048*\\
&(0.311)&(0.237)&(0.027)\\
married&0.154&0.189&0.035\\
&(0.361)&(0.393)&(0.036)\\
nodegree&0.835&0.708&-0.127***\\
&(0.372)&(0.456)&(0.039)\\
mosinex&17.862&18.492&0.630\\
&(5.574)&(4.911)&(0.511)\\
re74&2.107&2.096&-0.011\\
&(5.688)&(4.887)&(0.516)\\
re75&1.267&1.532&0.265\\
&(3.103)&(3.219)&(0.303)\\
\hline
Observations & 260 & 185 & 445 \\
\hline\hline
\end{tabular}
```!LaTeX Error: Missing \begin{document}.
See the LaTeX manual or LaTeX Companion for explanation.
Type H <return> for immediate help.
...
l.1 \begin{tabular}
{l*{3}c}
?```
In LaTeX, there's some lines you should always have. \documentclass{article} (doesn't have to be the article format). Afterwards, there is the document environment where your tabular environment would be in. This would look like:
\documentclass{article}
\begin{document}
\begin{tabular}{l*{3}c}
\hline\hline
& (1) & (2) & (3) \\ \hline
agesq & 677.315 & 717.395 & 40.079 \\
& (428.784) & (431.252) & (41.341) \\
educ & 10.088 & 10.346 & 0.257 \\
& (1.614) & (2.011) & (0.172) \\
black & 0.827 & 0.843 & 0.016 \\
& (0.379) & (0.365) & (0.036) \\
hisp & 0.108 & 0.059 & -0.048* \\
& (0.311) & (0.237) & (0.027) \\
married & 0.154 & 0.189 & 0.035 \\
& (0.361) & (0.393) & (0.036) \\
nodegree& 0.835 & 0.708 & -0.127*** \\
& (0.372) & (0.456) & (0.039) \\
mosinex & 17.862 & 18.492 & 0.630 \\
& (5.574) & (4.911) & (0.511) \\
re74 & 2.107 & 2.096 & -0.011 \\
& (5.688) & (4.887) & (0.516) \\
re75 & 1.267 & 1.532 & 0.265 \\
& (3.103) & (3.219) & (0.303) \\
\hline
Observations & 260 & 185 & 445 \\
\hline\hline
\end{tabular}
\end{document}
Indentations and spacing aren't required but they do make the document more understandable for the writer. Here's what this document generates:
How can I recreate this table in latex? I didn't want to create a simple document in Word for my documentation and I'm trying my hand.
For now I have trivially solved the problem by integrating this table as a png.
Thank you for your time
Have a look at https://www.tablesgenerator.com/
Here is a sample based on your query:
Sample table LaTeX code
% Please add the following required packages to your document preamble:
% \usepackage{multirow}
\begin{table}[]
\begin{tabular}{llll}
use case \#6 & \multicolumn{3}{l}{Aggiungi} \\
& \multicolumn{3}{l}{} \\
& \multicolumn{3}{l}{} \\
& \multicolumn{3}{l}{} \\
\multirow{2}{*}{Description} & Step & Iscritto & Sistema \\
& & &
\end{tabular}
\end{table}
Here is a sketch:
\documentclass{article}
\usepackage{multirow}
\usepackage[table]{xcolor}
\begin{document}
\setlength{\tabcolsep}{.5em}
\renewcommand{\arraystretch}{1.2}
\begin{table}[htbp]
\begin{tabular}{|p{.2\textwidth}|p{.08\textwidth}|p{.33\textwidth}|p{.33\textwidth}|}
\hline
\cellcolor{blue!20}\textbf{Use} & \multicolumn{3}{l|}{\cellcolor{blue!20}Aggiungi}\\\hline
Goal & \multicolumn{3}{l|}{L'utente}\\\hline
Pre & \multicolumn{3}{l|}{L'utente}\\\hline
Success & \multicolumn{3}{l|}{L'utente}\\\hline
Failed & \multicolumn{3}{l|}{L'utente}\\\hline
Primary & \multicolumn{3}{l|}{Iscritto}\\\hline
Trigger & \multicolumn{3}{l|}{L'utente}\\\hline
\multirow{5}{*}{Description} & \cellcolor{blue!20}Step & \cellcolor{blue!20}Iscritto & \cellcolor{blue!20}Sistema\\\cline{2-4}
& 1 & Preme & \\\cline{2-4}
& 2 & & Mostra\\\cline{2-4}
& 3 & Seleziona & \\\cline{2-4}
& 4 & & Mostra\\\hline
\multirow{2}{*}{\parbox{.19\textwidth}{Extension \#1\\ blah blah}} %
& \cellcolor{blue!20}Step & \cellcolor{blue!20}Iscritto & \cellcolor{blue!20}Sistema\\\cline{2-4}
& In un qual\-sia\-si pun\-to & 2 & 3\\\hline
\multirow{2}{*}{\parbox{.19\textwidth}{Extension \#1\\ blah blah}} %
& \cellcolor{blue!20}Step & \cellcolor{blue!20}Iscritto & \cellcolor{blue!20}Sistema\\\cline{2-4}
& 1 & 2 & 3\\\hline
\multirow{2}{*}{\parbox{.19\textwidth}{Extension \#1\\ blah blah}} %
& \cellcolor{blue!20}Step & \cellcolor{blue!20}Iscritto & \cellcolor{blue!20}Sistema\\\cline{2-4}
& 1 & 2 & 3\\\hline
\end{tabular}
\end{table}
\end{document}
Check the two package in the header, needed to run.
You can also implement sans serif font, if you want.
This is the output of the above code:
How to remove the extra space between the text of the first and second rows? Thanks in advance!
\documentclass[jou]{apa7}
\usepackage{siunitx}
\usepackage{textcomp}
\begin{document}
\begin{tabular}{m{13em}m{1cm}m{1cm}m{1cm}m{13em}m{1cm}m{1cm}m{1cm}} \hline
& A & B & C & & D & E & F \\ \hline
Model 1: Name of the first model inserted here & & & & Model 2: Name of the second model inserted here & & & & \\
\hspace{3mm} Integration strategies & .03 & .10 & .000 & Integration strategies & .34 & .08 & .000 \\
\hspace{3mm} Integration strategies & .12 & .03 & .56 & Integration strategies & .12 & .19 & .404\\
\end{tabular}
\end{document}
Your table is defined with 9 columns, but in the second row you use 10. You will get an error about this, so you shouldn't even look at what might or might not be a valid pdf.
If the error is fixed, the table will look like this:
\documentclass[jou]{apa7}
\usepackage{siunitx}
\usepackage{textcomp}
\begin{document}
\begin{tabular}{m{13em}m{1cm}m{1cm}m{1cm}m{13em}m{1cm}m{1cm}m{1cm}} \hline
& A & B & C & & D & E & F \\ \hline
Model 1: Name of the first model inserted here & & & & Model 2: Name of the second model inserted here & & & \\
\hspace{3mm} Integration strategies & .03 & .10 & .000 & Integration strategies & .34 & .08 & .000 \\
\hspace{3mm} Integration strategies & .12 & .03 & .56 & Integration strategies & .12 & .19 & .404\\
\end{tabular}
\end{document}
Instead of hard-coding the widths of all columns, it might be easier to use the tabularx package (and maybe the booktabs package for better spacing):
\documentclass[jou]{apa7}
\usepackage{siunitx}
\usepackage{textcomp}
\usepackage{tabularx}
\usepackage{booktabs}
\begin{document}
\begin{tabularx}{\linewidth}{XlllXlll}
\toprule
& A & B & C & & D & E & F \\
\midrule
Model 1: Name of the first model inserted here & & & & Model 2: Name of the second model inserted here & & & \\
\quad Integration strategies & .03 & .10 & .000 & Integration strategies & .34 & .08 & .000 \\
\quad Integration strategies & .12 & .03 & .56 & Integration strategies & .12 & .19 & .404\\
\bottomrule
\end{tabularx}
\end{document}
Normally I would also suggest to use #{}XlllXlll#{} to remove the space in front and after the columns, but for this specific example, this lead to a really bad linebreak