# fullwidth: Trying to change paragraph margins doesn't work as expected

The fullwidth package (current version 0.1) by Marco Daniel "provides the environment fullwidth which allows to set the left and right margins in a very simple way" (manual, p. 1). According to the manual, the package is based on the algorithm of the mdframed package (current version 1.0) by the same author.

However, trying to change margins of individual paragraphs with fulllwidth doesn't yield the desired results. Setting the leftmargin option to a positive value will move the whole paragraph to the right (into the right page margin), and setting rightmargin to a positive value doesn't have any effect at all. (The mdframed package, on the other hand, changes the respective margins as expected [and adds a frame around the paragraph].) fullwidths behaviour can't be correct, can it?

\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}


• @MarcoDaniel: You might be interested in this one. Dec 4, 2011 at 11:41
• I am interested ;-). The output of fullwidth is inside \leftmargin instead mdframed uses a combination of \makebox. I have no problem to discuss the behavior. At the moment you must set the width (good or not?). That rightmargin has no influence is really a bug. Dec 4, 2011 at 11:50
• @Marco: I think mdframeds behaviour for leftmargin=3em (adding a left margin of 3em and not changing the right margin) is more intuitive. It also corresponds to the working of KOMA-Scripts addmargin environment. Dec 4, 2011 at 11:54
• In relation to addmargin it is easier for the user. I will change that. Please note it is version 0.1 so I will change some settings ;-) github.com/marcodaniel/fullwidth Dec 4, 2011 at 12:02
• @MarcoDaniel: I really like the idea of key--value syntax. I'm also aware that the package version is 0.1 (and did mention the fact in my question). I was simply expecting a behaviour similar to that of mdframed. Dec 4, 2011 at 12:05

@lockstep: Do you think that the following behavior is more efficient?

\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}%
\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}

• It resembles mdframed and therefore is what I expected (at least with respect to left and right margins). Perhaps the vertical skip before and after the fullwidth environment should also be 0pt by default. But you're the package author. ;-) Dec 4, 2011 at 12:21
• @lockstep: I am happy about every comment ;-) Dec 4, 2011 at 12:25
• I will read the manual thoroughly in the next weeks to see if I can come up with further suggestions for "self-explanatory" behaviour. (And I'm glad that I pointed you to a real bug.) Dec 4, 2011 at 12:30