小页面并排格式

小页面并排格式

我尝试了几个不同的命令来并排显示我的小页面。但我不知道它的正确语法应该是什么。

\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage{tikz}
\usepackage{amsmath}


\begin{document}
\begin{minipage}{1mm}
\begin{minipage}[t]{0.5\textwidth}
\flushleft

\begin{tikzpicture}[scale=1.25]%,cap=round,>=latex]

\coordinate [label=left:$C$] (A) at (-1.5cm,-1.cm);
\coordinate [label=right:$A$] (C) at (1.5cm,-1.0cm);
\coordinate [label=above:$B$] (B) at (1.5cm,1.0cm);
\draw (A) -- node[above] {$a$} (B) -- node[right] {$c$} (C) -- node[below] {$b$} (A);

\draw (1.25cm,-1.0cm) rectangle (1.5cm,-0.75cm);

\end{tikzpicture}

\end{minipage} 
\hfil 
\begin{minipage}{0.5\textwidth} 
\flushright
\begin{align*}
skalafaktor &= \frac{A}{a1} \\
skalafaktor &= \frac{7.3}{4.5} = x
\end{align*}

\end{minipage}
\end{minipage}


  \end{document}

在此处输入图片描述

答案1

为什么外层minipage宽度为 1mm?需要注意以下几点:

  • 删除\noindent标准段落缩进。

  • %第一个之后的删除minipage了原本应该放在两个小页面之间的单词间距。如果没有这个,您将得到一个过满的hbox

  • 两个 s 的垂直“锚点”minipage都已设置为c,因此它们按中心垂直对齐。

  • skalafaktor已放置在\text宏中。

\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage{tikz}
\usepackage{amsmath}


\begin{document}
\noindent\begin{minipage}[c]{0.5\textwidth}
\begin{tikzpicture}[scale=1.25]%,cap=round,>=latex]

\coordinate [label=left:$C$] (A) at (-1.5cm,-1.cm);
\coordinate [label=right:$A$] (C) at (1.5cm,-1.0cm);
\coordinate [label=above:$B$] (B) at (1.5cm,1.0cm);
\draw (A) -- node[above] {$a$} (B) -- node[right] {$c$} (C) -- node[below] {$b$} (A);

\draw (1.25cm,-1.0cm) rectangle (1.5cm,-0.75cm);

\end{tikzpicture}

\end{minipage}%
\begin{minipage}[c]{0.5\textwidth} 
\flushright
\begin{align*}
\text{skalafaktor} &= \frac{A}{a1} \\
\text{skalafaktor} &= \frac{7.3}{4.5} = x
\end{align*}

\end{minipage}

\end{document}

您还可以minipage完全删除 s,并将方程式放在 a 中node

\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage{tikz}
\usepackage{amsmath}


\begin{document}
\begin{tikzpicture}[scale=1.25]%,cap=round,>=latex]

\coordinate [label=left:$C$] (A) at (-1.5cm,-1.cm);
\coordinate [label=right:$A$] (C) at (1.5cm,-1.0cm);
\coordinate [label=above:$B$] (B) at (1.5cm,1.0cm);
\draw (A) -- node[above] {$a$} (B) -- node[right] {$c$} (C) -- node[below] {$b$} (A);

\draw (1.25cm,-1.0cm) rectangle (1.5cm,-0.75cm);

\node [right] at (2.5cm,0) {%
$\begin{aligned}
\text{skalafaktor} &= \frac{A}{a1} \\
\text{skalafaktor} &= \frac{7.3}{4.5} = x
\end{aligned}$};
\end{tikzpicture}

\end{document}

答案2

如果使用minipages,LaTeX 会将 的基线tikzpicture与 的第一行对齐array。我假设您希望方程式垂直居中,您可以通过几种不同的方式实现。(1)使用\adjustbox将两个 s 垂直居中minipage。(2)忘记使用minipage并在 TikZ 中执行所有操作(如在接受的答案中)。

\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage{tikz}
    \usetikzlibrary{positioning}
\usepackage{amsmath}
\usepackage{adjustbox}

\begin{document}
\adjustbox{valign=c}{%
\begin{minipage}[t]{0.5\textwidth}
\begin{tikzpicture}[scale=1.25]%,cap=round,>=latex]
\coordinate [label=left:$C$] (A) at (-1.5cm,-1.cm);
\coordinate [label=right:$A$] (C) at (1.5cm,-1.0cm);
\coordinate [label=above:$B$] (B) at (1.5cm,1.0cm);
\draw (A) -- node[above] {$a$} (B) -- node(c)[right] {$c$} (C) -- node[below] {$b$} (A);
\draw (1.25cm,-1.0cm) rectangle (1.5cm,-0.75cm);
\end{tikzpicture}
\end{minipage}
}
\adjustbox{valign=c}{%
\begin{minipage}{0.5\textwidth} 
\flushright
\begin{align*}
skalafaktor &= \frac{A}{a1} \\
skalafaktor &= \frac{7.3}{4.5} = x
\end{align*}
\end{minipage}
}

\begin{tikzpicture}[scale=1.25]%,cap=round,>=latex]
\coordinate [label=left:$C$] (A) at (-1.5cm,-1.cm);
\coordinate [label=right:$A$] (C) at (1.5cm,-1.0cm);
\coordinate [label=above:$B$] (B) at (1.5cm,1.0cm);
\draw (A) -- node[above] {$a$} (B) -- node[right] {$c$} (C) -- node[below] {$b$} (A);
\draw (1.25cm,-1.0cm) rectangle (1.5cm,-0.75cm);

\node [right=2 cm of c]{$
   \begin{aligned}
   skalafaktor &= \frac{A}{a1} \\
   skalafaktor &= \frac{7.3}{4.5} = x
   \end{aligned}
$};
\end{tikzpicture}
\end{document}

在此处输入图片描述

相关内容