我正在编写一个“备忘单”,将一堆公式和想法放在框架内,一个接一个地堆叠起来。
问题是段落缩进、框架框分隔符和框架框规则导致 \hbox 过满。我可以使用 \noindent 修复段落缩进,但我不知道如何修复其他两个问题。
这是一个演示该问题的示例。理想情况下,我希望让表单尽可能简单。解决这个问题最简单的方法是什么?
\documentclass{article}
\usepackage[margin=.2in, landscape, showframe=true]{geometry}
\begin{document}
\noindent\fbox{kinematics}
\fbox{$\frac {v^2} 2 - \frac {v_0^2} 2 = \int_{x_0}^x a dx$ (5.8)}
\fbox{curvilinear motion: velocity}
\fbox{$\vec{v} = \vec{u_T} \frac {ds} {dt} = \vec{u_T} v$ (5.23)}
\fbox{curvilinear motion: \emph{constant} acceleration}
\fbox{time to highest point $t = \frac {v_0 \sin \alpha} {g}$ (5.38)}
\fbox{maximum height $h = \frac {v_0^2 \sin^2 \alpha} {2g}$ (5.39)}
\fbox{range $R = \frac {v_0^2 \sin\alpha \cos\alpha} {g} = \frac {v_0^2 \sin 2\alpha} {g} $ (5.40)}
\fbox{tangential and normal (centripetal) acceleration}
\fbox{$\vec{a} = \frac {d\vec{v}} {dt} = \vec{u_T} \frac {dv} {dt} + \frac {d\vec{u_T}} {dt} v$}
\end{document}
答案1
\documentclass{article}
\usepackage[margin=.2in, landscape, showframe=true]{geometry}
\begin{document}
\raggedright
\fbox{kinematics}
\fbox{$\frac {v^2} 2 - \frac {v_0^2} 2 = \int_{x_0}^x a dx$ (5.8)}
\fbox{curvilinear motion: velocity}
\fbox{$\vec{v} = \vec{u_T} \frac {ds} {dt} = \vec{u_T} v$ (5.23)}
\fbox{curvilinear motion: \emph{constant} acceleration}
\fbox{time to highest point $t = \frac {v_0 \sin \alpha} {g}$ (5.38)}
\fbox{maximum height $h = \frac {v_0^2 \sin^2 \alpha} {2g}$ (5.39)}
\fbox{range $R = \frac {v_0^2 \sin\alpha \cos\alpha} {g} = \frac {v_0^2 \sin 2\alpha} {g} $ (5.40)}
\fbox{tangential and normal (centripetal) acceleration}
\fbox{$\vec{a} = \frac {d\vec{v}} {dt} = \vec{u_T} \frac {dv} {dt} + \frac {d\vec{u_T}} {dt} v$}
\bigskip
or
\bigskip
\spaceskip=1sp
\let\oldfbox\fbox
\renewcommand\fbox[1]{\oldfbox{\spaceskip0pt\relax #1}}
\fbox{kinematics}
\fbox{$\frac {v^2} 2 - \frac {v_0^2} 2 = \int_{x_0}^x a dx$ (5.8)}
\fbox{curvilinear motion: velocity}
\fbox{$\vec{v} = \vec{u_T} \frac {ds} {dt} = \vec{u_T} v$ (5.23)}
\fbox{curvilinear motion: \emph{constant} acceleration}
\fbox{time to highest point $t = \frac {v_0 \sin \alpha} {g}$ (5.38)}
\fbox{maximum height $h = \frac {v_0^2 \sin^2 \alpha} {2g}$ (5.39)}
\fbox{range $R = \frac {v_0^2 \sin\alpha \cos\alpha} {g} = \frac {v_0^2 \sin 2\alpha} {g} $ (5.40)}
\fbox{tangential and normal (centripetal) acceleration}
\fbox{$\vec{a} = \frac {d\vec{v}} {dt} = \vec{u_T} \frac {dv} {dt} + \frac {d\vec{u_T}} {dt} v$}
\end{document}
答案2
通过手动段落分隔符和 fom\hfill
命令,您可以实现以下目标:
\documentclass{article}
\setlength{\parindent}{0pt}
\usepackage[margin=.2in, landscape, showframe=true]{geometry}
\begin{document}
\fbox{kinematics}\hfill
\fbox{$\frac {v^2} 2 - \frac {v_0^2} 2 = \int_{x_0}^x a dx$ (5.8)}\hfill
\fbox{curvilinear motion: velocity}\hfill
\fbox{$\vec{v} = \vec{u_T} \frac {ds} {dt} = \vec{u_T} v$ (5.23)}\hfill
\fbox{curvilinear motion: \emph{constant} acceleration}\hfill
\fbox{time to highest point $t = \frac {v_0 \sin \alpha} {g}$ (5.38)}
\fbox{maximum height $h = \frac {v_0^2 \sin^2 \alpha} {2g}$ (5.39)}
\fbox{range $R = \frac {v_0^2 \sin\alpha \cos\alpha} {g} = \frac {v_0^2 \sin 2\alpha} {g} $ (5.40)}
\fbox{tangential and normal (centripetal) acceleration}
\fbox{$\vec{a} = \frac {d\vec{v}} {dt} = \vec{u_T} \frac {dv} {dt} + \frac {d\vec{u_T}} {dt} v$}
\end{document}
答案3
使用更简单的语法。这会在每两个框之间插入一个零跳过,以便有一个可行的断点。\raggedright
我们最终得到了所需的输出。
\documentclass{article}
\usepackage[margin=.2in, landscape, showframe=true]{geometry}
\usepackage{xparse}
\ExplSyntaxOn
\NewDocumentCommand{\boxes}{m}
{
\seq_set_split:Nnn \l_tmpa_seq { \\ } { #1 }
\seq_map_variable:NNn \l_tmpa_seq \l_tmpa_tl { \fbox{\l_tmpa_tl}\hspace{0pt} }
\par
}
\ExplSyntaxOff
\begin{document}
\raggedright
\boxes{
kinematics \\
$\frac {v^2} 2 - \frac {v_0^2} 2 = \int_{x_0}^x a dx$ (5.8) \\
curvilinear motion: velocity \\
$\vec{v} = \vec{u_T} \frac {ds} {dt} = \vec{u_T} v$ (5.23) \\
curvilinear motion: \emph{constant} acceleration \\
time to highest point $t = \frac {v_0 \sin \alpha} {g}$ (5.38) \\
maximum height $h = \frac {v_0^2 \sin^2 \alpha} {2g}$ (5.39) \\
range $R = \frac {v_0^2 \sin\alpha \cos\alpha} {g} = \frac {v_0^2 \sin 2\alpha} {g} $ (5.40) \\
tangential and normal (centripetal) acceleration \\
$\vec{a} = \frac {d\vec{v}} {dt} = \vec{u_T} \frac {dv} {dt} + \frac {d\vec{u_T}} {dt} v$
}
\end{document}
您还可以获得理由:
\ExplSyntaxOn
\NewDocumentCommand{\boxes}{m}
{
\seq_set_split:Nnn \l_tmpa_seq { \\ } { #1 }
\noindent
\seq_map_variable:NNn \l_tmpa_seq \l_tmpa_tl { \fbox{\l_tmpa_tl}\hspace{0pt plus 0.01fil} }
\par
}
\ExplSyntaxOff
但这更有可能导致线路过满。