MWE 截图

MWE 截图

因为这是不可能的,或者至少真的hacky,为了将命令分成两个参数,我宁愿使用具有新环境的宏来实现更快的排版体验和一致的外观。

我打算在小页面周围放置一个比其所在的列宽更小/更窄的框,因此我尝试了新的环境。

然后我遇到了下一个问题:带有 mdframed 的框设置似乎不符合列宽。

=> 为什么第一个框的宽度不合适?是我犯了错误还是我忽略了什么?

(讽刺的是,错误版本在橙色文本行之前的垂直间距更美观。这是我后来想要微调的,但显然已经无意中这样做了。)

MWE 截图

在此处输入图片描述

平均能量损失

\documentclass[
11pt,
a4paper,
]
{scrartcl}

\usepackage{
lmodern,
multicol,
blindtext,
mdframed,
}

\usepackage[svgnames]{xcolor}

\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}


\newenvironment{envstuff}[2]{%
\begin{center}
\begin{mdframed}
\begin{minipage}[t]{0.9\columnwidth}\sffamily
\centering
\textcolor{orange}{\textbf{Something:}}~{#1}
\par\addvspace{-0.8ex}%
\rule{0.98\textwidth}{0.1pt}\par\addvspace{1ex}
\begin{minipage}[t]{0.98\columnwidth}\small\sffamily
{#2}}
{\end{minipage}
\end{minipage}
\end{mdframed}
\end{center}}

\listfiles

\begin{document}
\begin{center}\huge
Title stuff
\end{center}

\begin{multicols*}{2}
\section{Word}

\begin{envstuff}
{Words}{There really are words.
And then some.
AAaaaa bbbb cccc.
}
\end{envstuff}

{\centering
\fbox{
\begin{minipage}[t]{0.9\columnwidth}\sffamily
\centering
\textcolor{orange}{\textbf{Something:}}~{Words}
\par\addvspace{-0.8ex}%
\rule{0.98\textwidth}{0.1pt}\par\addvspace{1ex}
\begin{minipage}[t]{0.98\columnwidth}\small\sffamily
There really are words.
And then some.
AAaaaa bbbb cccc.
\end{minipage}
\end{minipage}}\par}


\blindtext[1]

\end{multicols*}
\end{document}

答案1

我猜测,以下内容更接近预期的输出:

在此处输入图片描述

\documentclass[
11pt,
a4paper,
]
{scrartcl}

\usepackage{
lmodern,
multicol,
blindtext,
mdframed,
}

\usepackage[svgnames]{xcolor}

\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}


\newenvironment{envstuff}[2]{%
\centering
\begin{mdframed}[userdefinedwidth=0.95\columnwidth, align=center, innerleftmargin=6pt, innerrightmargin=6pt]
\begin{minipage}[t]{\linewidth}\sffamily
\centering
\textcolor{orange}{\textbf{Something:}}~{#1}
\par\addvspace{-0.8ex}%
\rule{0.98\textwidth}{0.1pt}\par\addvspace{1ex}
\begin{minipage}[t]{\linewidth}\small\sffamily
{#2}}
{\end{minipage}
\end{minipage}
\end{mdframed}
}



\begin{document}
\begin{center}\huge
Title stuff
\end{center}

\begin{multicols*}{2}
\section{Word}

\begin{envstuff}
{Words}{There really are words.
And then some.
AAaaaa bbbb cccc.
}
\end{envstuff}

\blindtext[1]

\end{multicols*}
\end{document}

相关内容