1

I have searched a few times, and have not found anything on here which fixes my issue. Essentially, I am using the geometry package with a margin of 0.75in; however, when I use the vbox with a description, the margins don't seem to be enforced at 0.75in anymore, and instead it goes (nearly) to the very left and right of the page.

In order to force the left side, I can use \indent but I'm not sure about how to fix the right side. I also don't think this is the best idea, since it is more of a cheat. Here is basically what I am doing:

\usepackage[margin=0.75in]{geometry}
\begin{document}
\begin{sloppypar}
\begin{description}
    \indent\vbox{
        \phantomsection
        \label{def:one}
        \item[One] Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Dolor sed viverra ipsum nunc aliquet bibendum enim. In massa tempor nec feugiat. 
    }
    \indent\vbox{
        \phantomsection
        \label{def:two}
        \item[Two] Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Dolor sed viverra ipsum nunc aliquet bibendum enim. In massa tempor nec feugiat. 
    }
    \indent\vbox{
        \phantomsection
        \label{def:three}
        \item[Three] Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Dolor sed viverra ipsum nunc aliquet bibendum enim. In massa tempor nec feugiat. 
    }
\end{description}
\end{sloppypar}
\end{document}

It would appear that this is caused by the vbox (when I remove it, both the right and left margin is respected); however I use the vbox to prevent the description from splitting at page boundaries; and also to use the phantom section and label, so removing it isn't a practical option for me.

  • 1
    \vbox is not a latex command and should never appear in a document, use \parbox. – David Carlisle Sep 11 at 12:52
  • @DavidCarlisle What is wrong with vbox? I've seen it used before (even on here) as a way to prevent the page breaks. Is it just deprecated in favour of parbox, or is there some other issues with it? Switching to parbox did fix the issue though. – ChrisMM Sep 11 at 12:53
  • In any case, the width of \vbox is \hsize. You would need to add \advance\hsize by -\parindent. – John Kormylo Sep 11 at 13:09
  • latex defines all its box commands to work in a consistent way, eg lists inside parbox (but not vbox) know their target width, a parbox inside a center environment will be centred (vbox will not) etc... \vbox is a tex primitive which is unfortunately "visible" in latex due to the macro expansion nature of the latex implementation, but it is not a latex command and should not be used in documents. (You can use it to implement latex commands, if done with care) – David Carlisle Sep 11 at 13:10
  • Thank you for the explanation. That makes it much clearer :) – ChrisMM Sep 11 at 13:38
2

Use thing like \parbox instead

\documentclass{article}

\usepackage[margin=0.75in,showframe]{geometry}
\usepackage{hyperref}
\begin{document}
\begin{sloppypar}
\begin{description}
    \parbox{\linewidth}{%
        \phantomsection
        \label{def:one}
        \item[One] Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Dolor sed viverra ipsum nunc aliquet bibendum enim. In massa tempor nec feugiat. 
    }
    \parbox{\linewidth}{%
        \phantomsection
        \label{def:two}
        \item[Two] Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Dolor sed viverra ipsum nunc aliquet bibendum enim. In massa tempor nec feugiat. 
    }
    \parbox{\linewidth}{%
        \phantomsection
        \label{def:three}
        \item[Three] Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Dolor sed viverra ipsum nunc aliquet bibendum enim. In massa tempor nec feugiat. 
    }
\end{description}
\end{sloppypar}
\end{document}
  • Thank you very much :) – ChrisMM Sep 11 at 12:52

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.