回答我另一个问题之后,其中有自定义的minipage
引号设置,
\documentclass[12pt]{article}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage[
a6paper,
showframe,
]{geometry}
\newenvironment{myquote}[1]{%
\par
\begin{minipage}{\dimexpr\textwidth-2\parindent\relax}%
\def\myquoteauthorname{#1}%
}{%
\par\vspace{1ex}
\noindent
\hspace*{0.25\textwidth}%
\rule{0.5\textwidth}{.4pt}
\par\vspace{1ex}
\centering
\textsc{\myquoteauthorname}\par
\end{minipage}
\par}
\begin{document}
\begin{myquote}{Robert Kleinhenz}
When asked what it was like to set about proving something, the mathematician
likened proving a theorem to seeing the peak of a mountain and trying to climb
to the top. One establishes a base camp and begins scaling the mountain's sheer
face, encountering obstacles at every turn, often retracing one's steps and
struggling every foot of the journey. Finally when the top is reached, one
stands examining the peak, taking in the view of the surrounding countryside
and then noting the automobile road up the other side!
\end{myquote}
\end{document}
输出内容如下:
对于双栏论文,我将其替换\textwidth
为\columnwidth
:
\documentclass[12pt, twocolumn]{article}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage[
a4paper,
showframe,
]{geometry}
\newenvironment{myquotecolumn}[1]{%
\par
\begin{minipage}{\dimexpr\columnwidth -2\parindent\relax}%
\def\myquoteauthorname{#1}%
}{%
\par\vspace{1ex}
\noindent
\hspace*{0.25\columnwidth }%
\rule{0.5\columnwidth }{.4pt}
\par\vspace{1ex}
\centering
\textsc{\myquoteauthorname}\par
\end{minipage}
\par}
\begin{document}
\begin{myquotecolumn}{Robert Kleinhenz}
When asked what it was like to set about proving something, the mathematician
likened proving a theorem to seeing the peak of a mountain and trying to climb
to the top. One establishes a base camp and begins scaling the mountain's sheer
face, encountering obstacles at every turn, often retracing one's steps and
struggling every foot of the journey. Finally when the top is reached, one
stands examining the peak, taking in the view of the surrounding countryside
and then noting the automobile road up the other side!
\end{myquotecolumn}
\end{document}
输出结果为:
是否有可能将它们结合起来?我有一个环境,它可以自行调整是单列还是双列?
答案1
您可以简单地使用第二个定义,就像单列模式\columnwidth
一样。实际上,我可能会使用。这样,如果您在列表项(等)内使用环境,则将居中\textwidth
\linewidth
itemize
minipage
在该项目内(规则长度会适应其宽度)。当然,这只是个人喜好问题(在这种用例中,您的期望由您决定)。\columnwidth
如果您在深层嵌套的列表中使用环境,则 的差异会非常明显:\columnwidth
不会改变,并且将保持大于\linewidth
,而 会随着每个嵌套级别而减小。
看\textwidth
和\linewidth
之间的区别\hsize
以获得对这些各种参数的精确描述,最值得注意的是 TeX\hsize
和 LaTeX 的 \textwidth
,\columnwidth
以及\linewidth
。