전폭: 단락 여백을 변경하려고 하면 예상대로 작동하지 않습니다.

전폭: 단락 여백을 변경하려고 하면 예상대로 작동하지 않습니다.

그만큼전체 넓이패키지(현재 버전 0.1)마르코 다니엘 fullwidth" 아주 간단한 방법으로 왼쪽과 오른쪽 여백을 설정할 수 있는 환경을 제공합니다 "(매뉴얼, 1페이지) 매뉴얼에 따르면 패키지는 다음의 알고리즘을 기반으로 합니다.mdframed동일한 작성자의 패키지(현재 버전 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}

관련 정보