我画了两幅图,现在想把它们并排摆放。我试过使用“minipage”,但是没有用。你能帮我吗?
\documentclass{article}
\usepackage{tikz}
\usepackage{amsmath}
\usepackage{xcolor}
\usepackage{graphicx}
\DeclareGraphicsExtensions{.pdf,.png,.jpg, .tif}
\usepackage{pgf,tikz}
\usetikzlibrary{arrows}
\usepackage{pgf}
\definecolor{amber}{rgb}{1.0, 0.49, 0.0}
\definecolor{byzantine}{rgb}{0.74, 0.2, 0.64}
\definecolor{royalazure}{rgb}{0.0, 0.22, 0.66}
\definecolor{darkpastelgreen}{rgb}{0.01, 0.75, 0.24}
\definecolor{ashgrey}{rgb}{0.7, 0.75, 0.71}
\begin{document}`
\begin{figure}[h] % place the figure [h]ere, you may want to give LaTeX some more options
\begin{minipage}[t]{0.5\linewidth}
\centering
\scalebox{0.75}{
\begin{tikzpicture}[line cap=round,line join=round,>=triangle 45,x=1.0cm,y=1.0cm,scale=0.7]
\path[fill=darkpastelgreen!70] (5.5,3.5)--(11,7)--(5.5,7)--cycle;
\path[fill=amber!70] (0,0)--(5.5,3.5)--(5.5,0)--cycle;
\path[fill=byzantine!70] (5.5,0)--(11,0)--(11,7)--(5.5,3.5)--cycle;
\path[fill=royalazure!70] (5.5,3.5)--(0,7)--(5.5,7)--cycle;
\draw[line width=0.5mm] (0,0) node [below] {A:$(0,0)$} -- (11,0) node [below] {B:$(p,0)$} -- (11,7) node [above] {C:$(p,q)$} -- (0,7) node [above] {D:$(0,q)$} -- (0,0);
\draw[line width=0.5mm] (0,0) -- (11,7);
\draw[line width=0.5mm] (0,3.5) node [above right] {E:$(0,\frac{q}{2})$} -- (5.5,3.5) node [below right] {F:$(\frac{p}{2},\frac{q}{2})$};
\draw[line width=0.5mm] (5.5,3.5) -- (0,7);
\draw[line width=0.5mm] (5.5,0) node [below] {G:$(\frac{p}{2},0)$} -- (5.5,7) node [above] {H:$(\frac{p}{2},q)$};
\draw[line width=0.5mm] (8.3,5.0) node [below] {$y=\frac{q}{p}x$};
\end{tikzpicture}
}
\caption{The outline of the lattice considered in Eisenstein's proof.}
\end{minipage}
\begin{minipage}[t]{0.5\linewidth}
\centering
\scalebox{0.4}{
\begin{tikzpicture}
\path[draw, line width=0.6mm, fill=ashgrey!25] (0,0) -- (13,0) -- (13,11) -- (0,11) -- (0,0)--cycle;
\draw[line width=0.5mm] (0,0) -- (13,11);
\draw[line width=0.5mm] (0,5.5) -- (6.5,5.5);
\draw[line width=0.5mm] (6.5,0) -- (6.5,11);
\draw[dashed, line width=0.0mm, black] (1,0) -- (1,11);
\draw[dashed, line width=0.0mm, black] (2,0) -- (2,11);
\draw[dashed, line width=0.0mm, black] (3,0) -- (3,11);
\draw[dashed, line width=0.0mm, black] (4,0) -- (4,11);
\draw[dashed, line width=0.0mm, black] (5,0) -- (5,11);
\draw[dashed, line width=0.0mm, black] (6,0) -- (6,11);
\draw[dashed, line width=0.0mm, black] (7,0) -- (7,11);
\draw[dashed, line width=0.0mm, black] (8,0) -- (8,11);
\draw[dashed, line width=0.0mm, black] (9,0) -- (9,11);
\draw[dashed, line width=0.0mm, black] (10,0) -- (10,11);
\draw[dashed, line width=0.0mm, black] (11,0) -- (11,11);
\draw[dashed, line width=0.0mm, black] (12,0) -- (12,11);
\draw[dashed, line width=0.0mm, black] (0,1) -- (13,1);
\draw[dashed, line width=0.0mm, black] (0,2) -- (13,2);
\draw[dashed, line width=0.0mm, black] (0,3) -- (13,3);
\draw[dashed, line width=0.0mm, black] (0,4) -- (13,4);
\draw[dashed, line width=0.0mm, black] (0,5) -- (13,5);
\draw[dashed, line width=0.0mm, black] (0,6) -- (13,6);
\draw[dashed, line width=0.0mm, black] (0,7) -- (13,7);
\draw[dashed, line width=0.0mm, black] (0,8) -- (13,8);
\draw[dashed, line width=0.0mm, black] (0,9) -- (13,9);
\draw[dashed, line width=0.0mm, black] (0,10) -- (13,10);
\filldraw[byzantine] (8,1) circle (4pt);
\filldraw[byzantine] (8,2) circle (4pt);
\filldraw[byzantine] (8,3) circle (4pt);
\filldraw[byzantine] (8,4) circle (4pt);
\filldraw[byzantine] (8,5) circle (4pt);
\filldraw[byzantine] (8,6) circle (4pt);
\filldraw[byzantine] (8,5) circle (4pt);
\filldraw[byzantine] (8,6) circle (4pt);
\filldraw[byzantine] (10,1) circle (4pt);
\filldraw[byzantine] (10,2) circle (4pt);
\filldraw[byzantine] (10,3) circle (4pt);
\filldraw[byzantine] (10,4) circle (4pt);
\filldraw[byzantine] (10,5) circle (4pt);
\filldraw[byzantine] (10,6) circle (4pt);
\filldraw[byzantine] (10,7) circle (4pt);
\filldraw[byzantine] (10,8) circle (4pt);
\filldraw[byzantine] (12,1) circle (4pt);
\filldraw[byzantine] (12,2) circle (4pt);
\filldraw[byzantine] (12,3) circle (4pt);
\filldraw[byzantine] (12,4) circle (4pt);
\filldraw[byzantine] (12,5) circle (4pt);
\filldraw[byzantine] (12,6) circle (4pt);
\filldraw[byzantine] (12,7) circle (4pt);
\filldraw[byzantine] (12,8) circle (4pt);
\filldraw[byzantine] (12,9) circle (4pt);
\filldraw[byzantine] (12,10) circle (4pt);
\filldraw[darkpastelgreen] (8,7) circle (4pt);
\filldraw[darkpastelgreen] (8,8) circle (4pt);
\filldraw[darkpastelgreen] (8,9) circle (4pt);
\filldraw[darkpastelgreen] (8,10) circle (4pt);
\filldraw[darkpastelgreen] (10,9) circle (4pt);
\filldraw[darkpastelgreen] (10,10) circle (4pt);
\filldraw[royalazure] (5,7) circle (4pt);
\filldraw[royalazure] (5,8) circle (4pt);
\filldraw[royalazure] (5,9) circle (4pt);
\filldraw[royalazure] (5,10) circle (4pt);
\filldraw[royalazure] (3,9) circle (4pt);
\filldraw[royalazure] (3,10) circle (4pt);
\filldraw[amber] (3,1) circle (4pt);
\filldraw[amber] (3,2) circle (4pt);
\filldraw[amber] (5,1) circle (4pt);
\filldraw[amber] (5,2) circle (4pt);
\filldraw[amber] (5,3) circle (4pt);
\filldraw[amber] (5,4) circle (4pt);
\end{tikzpicture}
}
\caption{The lattice used in Eisenstein's proof in case $p=13$ and $q=11$.}
\end{minipage}
\end{figure}
\end{document}
答案1
只需将您的代码放入另一个minipage
标签中即可解决问题:
\documentclass{article}
\usepackage{tikz}
\usepackage{amsmath}
\usepackage{xcolor}
\usepackage{graphicx}
\DeclareGraphicsExtensions{.pdf,.png,.jpg, .tif}
\usepackage{pgf,tikz}
\usetikzlibrary{arrows}
\usepackage{pgf}
\definecolor{amber}{rgb}{1.0, 0.49, 0.0}
\definecolor{byzantine}{rgb}{0.74, 0.2, 0.64}
\definecolor{royalazure}{rgb}{0.0, 0.22, 0.66}
\definecolor{darkpastelgreen}{rgb}{0.01, 0.75, 0.24}
\definecolor{ashgrey}{rgb}{0.7, 0.75, 0.71}
\begin{document}`
\begin{figure}[h] % place the figure [h]ere, you may want to give LaTeX some more options
\begin{minipage}{\textwidth}
\begin{minipage}[t]{0.5\linewidth}
\centering
\scalebox{0.75}{
\begin{tikzpicture}[line cap=round,line join=round,>=triangle 45,x=1.0cm,y=1.0cm,scale=0.7]
\path[fill=darkpastelgreen!70] (5.5,3.5)--(11,7)--(5.5,7)--cycle;
\path[fill=amber!70] (0,0)--(5.5,3.5)--(5.5,0)--cycle;
\path[fill=byzantine!70] (5.5,0)--(11,0)--(11,7)--(5.5,3.5)--cycle;
\path[fill=royalazure!70] (5.5,3.5)--(0,7)--(5.5,7)--cycle;
\draw[line width=0.5mm] (0,0) node [below] {A:$(0,0)$} -- (11,0) node [below] {B:$(p,0)$} -- (11,7) node [above] {C:$(p,q)$} -- (0,7) node [above] {D:$(0,q)$} -- (0,0);
\draw[line width=0.5mm] (0,0) -- (11,7);
\draw[line width=0.5mm] (0,3.5) node [above right] {E:$(0,\frac{q}{2})$} -- (5.5,3.5) node [below right] {F:$(\frac{p}{2},\frac{q}{2})$};
\draw[line width=0.5mm] (5.5,3.5) -- (0,7);
\draw[line width=0.5mm] (5.5,0) node [below] {G:$(\frac{p}{2},0)$} -- (5.5,7) node [above] {H:$(\frac{p}{2},q)$};
\draw[line width=0.5mm] (8.3,5.0) node [below] {$y=\frac{q}{p}x$};
\end{tikzpicture}
}
\caption{The outline of the lattice considered in Eisenstein's proof.}
\end{minipage}
\hskip12pt
\begin{minipage}[t]{0.5\linewidth}
\centering
\scalebox{0.4}{
\begin{tikzpicture}
\path[draw, line width=0.6mm, fill=ashgrey!25] (0,0) -- (13,0) -- (13,11) -- (0,11) -- (0,0)--cycle;
\draw[line width=0.5mm] (0,0) -- (13,11);
\draw[line width=0.5mm] (0,5.5) -- (6.5,5.5);
\draw[line width=0.5mm] (6.5,0) -- (6.5,11);
\draw[dashed, line width=0.0mm, black] (1,0) -- (1,11);
\draw[dashed, line width=0.0mm, black] (2,0) -- (2,11);
\draw[dashed, line width=0.0mm, black] (3,0) -- (3,11);
\draw[dashed, line width=0.0mm, black] (4,0) -- (4,11);
\draw[dashed, line width=0.0mm, black] (5,0) -- (5,11);
\draw[dashed, line width=0.0mm, black] (6,0) -- (6,11);
\draw[dashed, line width=0.0mm, black] (7,0) -- (7,11);
\draw[dashed, line width=0.0mm, black] (8,0) -- (8,11);
\draw[dashed, line width=0.0mm, black] (9,0) -- (9,11);
\draw[dashed, line width=0.0mm, black] (10,0) -- (10,11);
\draw[dashed, line width=0.0mm, black] (11,0) -- (11,11);
\draw[dashed, line width=0.0mm, black] (12,0) -- (12,11);
\draw[dashed, line width=0.0mm, black] (0,1) -- (13,1);
\draw[dashed, line width=0.0mm, black] (0,2) -- (13,2);
\draw[dashed, line width=0.0mm, black] (0,3) -- (13,3);
\draw[dashed, line width=0.0mm, black] (0,4) -- (13,4);
\draw[dashed, line width=0.0mm, black] (0,5) -- (13,5);
\draw[dashed, line width=0.0mm, black] (0,6) -- (13,6);
\draw[dashed, line width=0.0mm, black] (0,7) -- (13,7);
\draw[dashed, line width=0.0mm, black] (0,8) -- (13,8);
\draw[dashed, line width=0.0mm, black] (0,9) -- (13,9);
\draw[dashed, line width=0.0mm, black] (0,10) -- (13,10);
\filldraw[byzantine] (8,1) circle (4pt);
\filldraw[byzantine] (8,2) circle (4pt);
\filldraw[byzantine] (8,3) circle (4pt);
\filldraw[byzantine] (8,4) circle (4pt);
\filldraw[byzantine] (8,5) circle (4pt);
\filldraw[byzantine] (8,6) circle (4pt);
\filldraw[byzantine] (8,5) circle (4pt);
\filldraw[byzantine] (8,6) circle (4pt);
\filldraw[byzantine] (10,1) circle (4pt);
\filldraw[byzantine] (10,2) circle (4pt);
\filldraw[byzantine] (10,3) circle (4pt);
\filldraw[byzantine] (10,4) circle (4pt);
\filldraw[byzantine] (10,5) circle (4pt);
\filldraw[byzantine] (10,6) circle (4pt);
\filldraw[byzantine] (10,7) circle (4pt);
\filldraw[byzantine] (10,8) circle (4pt);
\filldraw[byzantine] (12,1) circle (4pt);
\filldraw[byzantine] (12,2) circle (4pt);
\filldraw[byzantine] (12,3) circle (4pt);
\filldraw[byzantine] (12,4) circle (4pt);
\filldraw[byzantine] (12,5) circle (4pt);
\filldraw[byzantine] (12,6) circle (4pt);
\filldraw[byzantine] (12,7) circle (4pt);
\filldraw[byzantine] (12,8) circle (4pt);
\filldraw[byzantine] (12,9) circle (4pt);
\filldraw[byzantine] (12,10) circle (4pt);
\filldraw[darkpastelgreen] (8,7) circle (4pt);
\filldraw[darkpastelgreen] (8,8) circle (4pt);
\filldraw[darkpastelgreen] (8,9) circle (4pt);
\filldraw[darkpastelgreen] (8,10) circle (4pt);
\filldraw[darkpastelgreen] (10,9) circle (4pt);
\filldraw[darkpastelgreen] (10,10) circle (4pt);
\filldraw[royalazure] (5,7) circle (4pt);
\filldraw[royalazure] (5,8) circle (4pt);
\filldraw[royalazure] (5,9) circle (4pt);
\filldraw[royalazure] (5,10) circle (4pt);
\filldraw[royalazure] (3,9) circle (4pt);
\filldraw[royalazure] (3,10) circle (4pt);
\filldraw[amber] (3,1) circle (4pt);
\filldraw[amber] (3,2) circle (4pt);
\filldraw[amber] (5,1) circle (4pt);
\filldraw[amber] (5,2) circle (4pt);
\filldraw[amber] (5,3) circle (4pt);
\filldraw[amber] (5,4) circle (4pt);
\end{tikzpicture}
}
\caption{The lattice used in Eisenstein's proof in case $p=13$ and $q=11$.}
\end{minipage}
\end{minipage}
\end{figure}
\end{document}
输出: