我已经编译了这段代码,但右边的部分有点乱。我想让右边的两个图表一个在另一个下面对齐(居中),但我无法做到这一点。有什么办法可以解决这个问题吗?我知道 minipage 的代码可能有问题,也许有更有效的方法。“caminotoro.pdf”是这。我知道放置链接不是最合适的,但在这种情况下,我不希望在将其转换为 png 或类似格式时尺寸发生变化。
\documentclass[12pt,a4paper]{report}
\usepackage[left=3.00cm, right=2.50cm, top=2.50cm, bottom=3.00cm]{geometry}
\usepackage[utf8]{inputenc}
\usepackage{tikz}
\usepackage{graphicx}
\usepackage{amssymb}
\newcounter{mx}
\newcounter{my}
\newlength{\squareside}
\newcommand*{\flattorus}[3][4]{%
\setcounter{mx}{#2}
\setcounter{my}{#3}
\addtocounter{mx}{-1}
\addtocounter{my}{-1}
\setlength{\squareside}{#1 cm}
\begin{tikzpicture}[x=\dimexpr\squareside/#2, y=\dimexpr\squareside/#3]
\draw[blue] (0,0) rectangle (#2,#3);
\foreach \x in {0, ..., \value{mx}}
\foreach \y in {0, ..., \value{my}}{
\draw[red, thick] (\x,\y) -- ++(1,1);
};
\end{tikzpicture}
}
\begin{document}
\begin{figure}[h]
\centering
\begin{tabular}{ccc}
\begin{minipage}{0.5\textwidth}
\begin{tikzpicture}[baseline=-1cm]
\draw (-1,0)node[below]{$\mathbb R$} -- (0,0)node[below=1mm]{$t$} -- (1,0)
node[midway,above,inner sep=4pt] (M0){};
\draw[thick,-] (0,-0.1) -- (0,0.1);
\draw[-stealth] (2,0) -- (6,0) node[below]{$x$};
\draw[-stealth] (4,-2) -- (4,2) node[left]{$y$};
\draw[red,thick] (2+0.5,-2+0.5) -- (6-0.5,2-0.5);
\draw[fill] (5,1) circle (0.5mm)node[below right=-0.5mm]{$\lambda(t)$};
\draw[-latex] (0,0.3) to[bend left] node[midway,above]{$\lambda$} (4.9,1.1);
\draw[-latex] (5.5,1.1) to[bend left] node[midway,above]{$\varphi$} (8,2);
\draw[-latex] (5.3,0.4) to[bend right] node[midway,below]{$\pi$} (8,-1.8);
\end{tikzpicture}
\end{minipage}&\textcolor{white}{.\qquad.}&
\begin{minipage}{0.5\textwidth}
\includegraphics[scale=0.8]{caminotoro.pdf} \\
{
\flattorus[3]{5}{7}
%\includegraphics[scale=0.8]{caminotoro.pdf}
} \end{minipage}
\end{tabular}
\end{figure}
\end{document}
答案1
答案2
不喜欢表格和小页面。它们只会占用图片太多空间。这是让你的图片更紧凑的简单方法。
\documentclass[12pt,a4paper]{report}
\usepackage[left=3.00cm, right=2.50cm, top=2.50cm, bottom=3.00cm]{geometry}
\usepackage[utf8]{inputenc}
\usepackage{tikz}
\usepackage{graphicx}
\usepackage{amssymb}
\newcounter{mx}
\newcounter{my}
\newlength{\squareside}
\newcommand*{\flattorus}[3][4]{%
\setcounter{mx}{#2}%
\setcounter{my}{#3}%
\addtocounter{mx}{-1}%
\addtocounter{my}{-1}%
\setlength{\squareside}{#1 cm}%
\begin{tikzpicture}[x=\dimexpr\squareside/#2,y=\dimexpr\squareside/#3]%
\draw[blue] (0,0) rectangle (#2,#3);%
\foreach \x in {0, ..., \value{mx}}%
\foreach \y in {0, ..., \value{my}}%
{%
\draw[red, thick] (\x,\y) -- ++(1,1);%
};%
\end{tikzpicture}}
\begin{document}
\begin{figure}[h]
\centering
\begin{tikzpicture}
\draw (-1,0)node[below]{$\mathbb R$} -- (0,0)node[below=1mm]{$t$} -- (1,0)
node[midway,above,inner sep=4pt] (M0){};
\draw[thick,-] (0,-0.1) -- (0,0.1);
\draw[-stealth] (2,0) -- (6,0) node[below]{$x$};
\draw[-stealth] (4,-2) -- (4,2) node[left]{$y$};
\draw[red,thick] (2+0.5,-2+0.5) -- (6-0.5,2-0.5);
\draw[fill] (5,1) circle (0.5mm)node[below right=-0.5mm]{$\lambda(t)$};
\draw[-latex] (0,0.3) to[bend left] node[midway,above]{$\lambda$} (4.9,1.1);
\draw[-latex] (5.5,1.1) to[bend left] node[midway,above]{$\varphi$} (8,2) node (phiend) {};
\draw[-latex] (5.3,0.4) to[bend right] node[midway,below]{$\pi$} (8,-1.8) node (piend) {};
\node [right,inner sep=0pt] at (phiend) {\includegraphics[width=5cm]{caminotoro.pdf}} ;
\node [right=1cm,inner sep=0pt] at (piend) {\flattorus[3]{5}{7}};
\end{tikzpicture}
\end{figure}
\end{document}