What is the standard way in latex to display certain objects (e.g. pictures, tables, etc.) side by side, instead of one below the other?
I thought about using the tabular environment for this, but I'm not sure if there isn't a better way.
[Tex/LaTex] Display certain objects in a document side by side
floatspositioning
Related Solutions
2nd version:
So the problem seems to include different figures in one pdf file. There are several solutions but as you use standalone
class and TiKZ
you just need to include tikz
as an option to your original example (\documentclass[tikz,varwidth,border=5pt]{standalone}
) and will get a pdf file with as many pages as tikzpictures
. You can include figures in your text with \includegraphics[page=...]{...}
.
\documentclass{article}
\usepackage{subcaption}
\usepackage{graphicx}
\usepackage{lipsum}
\begin{document}
\begin{figure}
\begin{subfigure}{.5\linewidth}
\centering
\includegraphics[page=1]{sensetitol-3}
\subcaption{Subfigure}
\end{subfigure}
\begin{subfigure}{.5\linewidth}
\centering
\includegraphics[page=2]{sensetitol-3}
\subcaption{Subfigure}
\end{subfigure}
\end{figure}
\lipsum[2]
\end{document}
Original answer:
I don't understand the problem you have with the journalgraphics requirements but if you want to place both figures side by side with varwidth
option one possible solution can be to draw both figures inside the same tikzpicture
with one of them inside a properly placed scope
.
Note: shift
values have been found by trial and error.
\documentclass[varwidth,border=5pt]{standalone}
\usepackage{tikz}
\usepackage{tikz-3dplot}
\usetikzlibrary{arrows}
\usetikzlibrary{3d}
\tikzset{>=latex}
\begin{document}
\tdplotsetmaincoords{90}{90}
\tdplotsetrotatedcoords{0}{20}{70}
\begin{tikzpicture}
\draw[-] (0,0)--(3,0)--(3,2)--(0,2)--cycle;
\draw[-] (0,2)--(3,2)--(3,4)--(0,4)--cycle;
\draw[-] (0,4)--(3,4)--(3,6)--(0,6)--cycle;
\node at (-0.4,5.7) {{\large a}};
\begin{scope}[tdplot_rotated_coords, xshift=6cm, yshift=2.5cm]
\draw[->, thick] (0,0,0) --++ (20:3);
\draw[->] (0,0,0) --++ (60:2);
\draw[dashed] (0,0,-2) circle(2);
\draw[dashed] (0,0,0) circle(2);
\draw[dashed] (0,0,2) circle(2);
\node[left] at (0,0,0) {{ $i$}};
\node[right] at (2.2,0.15,-0.05) {{\large {\bf M}}};
\node[below] at (0.5,0.5,0) {{\large $\phi_i$}};
\draw[->] (0,0,-2) -- (0,0,3.5);
\node[above] at (0,0,3.5) {{\large $z$}};
\node at (-2,0,3.5) {{\large b}};
\end{scope}
\end{tikzpicture}
\end{document}
using tabularx
for outer table and use table
environment:
\documentclass{article}
\usepackage[skip=1ex]{caption}
\usepackage{tabularx}
\newcolumntype{C}{>{\centering\arraybackslash}X}
\begin{document}
\begin{table}[htb]
\begin{tabularx}{\linewidth}{CC}
\caption{The first table}
\begin{tabular}{ccc}
A & B & C \\
\cline{1-3}
1 & 2 & 3 \\
\cline{1-3}
C & B & A \\
\end{tabular}
&
\caption{The second table}
\begin{tabular}{ccc}
D & E & F \\
\cline{1-3}
4 & 5 & 6 \\
\cline{1-3}
F & E & D \\
\end{tabular}
\end{tabularx}
\end{table}
\end{document}
addendum:
in cases, when one table is wider than other and wider than the column width, you can manually accommodate columns width of the outer table. for this is more appropriate to use tabular*
than tabularx
table environment:
\documentclass{article}
\usepackage[skip=1ex]{caption}
\usepackage{array}
\newcolumntype{C}[1]{>{\centering\arraybackslash}p{#1}}
\usepackage{lipsum}
\begin{document}
\lipsum[1]
\begin{table*}
\begin{tabular*}{\linewidth}{C{\dimexpr0.3\linewidth-2\tabcolsep}
C{\dimexpr0.7\linewidth-2\tabcolsep}}
\caption{The first table}
\begin{tabular}{ccc}
\hline
A & B & C \\
\hline
1 & 2 & 3 \\
C & B & A \\
\hline
\end{tabular}
&
\caption{The second table}
\begin{tabular}{*{14}{c}}
\hline
D & E & F & G & H & I & J & D & E & F & G & H & I & J \\
\hline
4 & 5 & 6 & 7 & 8 & 9 & 0 & 4 & 5 & 6 & 7 & 8 & 9 & 0 \\
J & I & H & G & F & E & D & J & I & H & G & F & E & D \\
\hline
\end{tabular}
\end{tabular*}
\end{table*}
\lipsum\lipsum
\end{document}
which gives:
Best Answer
The standard LaTeX way is minipages.
In order to make sure that your multiple minipages end up on the same line, their horizontal dimensions have to add up to something less than the current
\textwidth
. So if I care about lining them up, I often use multiples of\textwidth
as the minipage widths. Such asThe
\hfill
control sequence inserts an infinitely stretchable amount of glue between the minipages—effectively pushing the second one all the way to the edge of the line. Since the total widths of the boxes is0.9\textwidth
, you get a separation of0.1\textwidth
between the minipages.Another method is the
multicol
package, but that's mainly for columns of text side-by-side.