fullwidth:嘗試更改段落邊距無法如預期運作

fullwidth:嘗試更改段落邊距無法如預期運作

全螢幕寬度包(目前版本 0.1)由馬可·丹尼爾 fullwidth“提供允許以非常簡單的方式設定左右邊距的環境”(手冊,第 1 頁)。根據手冊,該包是基於演算法的多幀軟體包(目前版本 1.0)由同一作者提供。

但是,嘗試更改各個段落的頁邊距並fulllwidth不會產生預期的結果。將該leftmargin選項設為正值會將整個段落移到右側(進入右頁邊距),並且設定rightmargin為正值根本沒有任何效果。 (mdframed另一方面,該包按預期更改了各自的邊距[並在段落周圍添加了一個框架]。)fullwidth的行為不可能是正確的,不是嗎?

\documentclass{article}

\usepackage[linewidth=1.2pt]{mdframed}
\usepackage{fullwidth}

\newcommand*{\sometext}{Lorem ipsum dolor sit amet, consectetuer
    adipiscing elit. Ut purus elit, vestibulum ut, placerat ac,
    adipiscing vitae, felis. Curabitur dictum gravida mauris. Nam arcu
    libero, nonummy eget, consectetuer id, vulputate a, magna. Donec
    vehicula augue eu neque.}

\begin{document}

\section{\texttt{mdframed} works as expected}

\sometext

\begin{mdframed}[leftmargin=3em]
\sometext
\end{mdframed}

\begin{mdframed}[rightmargin=3em]
\sometext
\end{mdframed}

\section{But \texttt{fullwidth} doesn't}

\sometext

\begin{fullwidth}[leftmargin=3em]
\sometext
\end{fullwidth}

\begin{fullwidth}[rightmargin=3em]
\sometext
\end{fullwidth}

\end{document}

在此輸入影像描述

答案1

@lockstep:您認為以下行為更有效嗎?

\documentclass{article}
\usepackage{showframe}
\usepackage[linewidth=1.2pt]{mdframed}
\usepackage{fullwidth}

\newcommand*{\sometext}{Lorem ipsum dolor sit amet, consectetuer
    adipiscing elit. Ut purus elit, vestibulum ut, placerat ac,
    adipiscing vitae, felis. Curabitur dictum gravida mauris. Nam arcu
    libero, nonummy eget, consectetuer id, vulputate a, magna. Donec
    vehicula augue eu neque.}

\makeatletter
\def\fullwidth@i[#1]{% default-Umgebung
  \begingroup
  \fullwidthsetup{#1}%%
   \fwd@twoside@checklength%
   \ifbool{fwd@twosidemode}%
    {\advance\fwd@width@length by -\fwd@outermargin@length
     \advance\fwd@width@length by -\fwd@outermargin@length}%
    {\advance\fwd@width@length by -\fwd@leftmargin@length
     \advance\fwd@width@length by -\fwd@rightmargin@length}%
   \let\width\z@%
   \let\height\z@%
   \setlength{\topsep}{\fwd@skipabove@length}%
   \begingroup%
     \let\partopsep\z@%
   \expandafter\endgroup%   
   \begin{fwd@trivlist}\item\relax%
   \hsize=\fwd@width@length\relax%
   \fwd@footnoteinput%
   \begin{fwd@lrbox}{\@tempboxa}%
 }
\makeatother

\begin{document}

\section{\texttt{mdframed} works as expected}

\sometext

\begin{mdframed}[leftmargin=3em]
\sometext
\end{mdframed}

\begin{mdframed}[rightmargin=3em]
\sometext
\end{mdframed}

\section{But \texttt{fullwidth} doesn't}

\sometext

\begin{fullwidth}[leftmargin=3em]
\sometext
\end{fullwidth}

\begin{fullwidth}[rightmargin=3em]
\sometext
\end{fullwidth}

\null\hfill\smash{\rule[1.5cm]{3em}{2pt}}
\end{document}

相關內容