27

Is there a minipage-like environment that allows pagebreaks? Everything I can find is about avoiding page breaks (which minipage does well) but I want to indent a whole section, which is convenient to do by wrapping the section in minipage as \leftskip is overtaken by the environment enclosing this section.

2

3 Answers 3

17

Another option is to use adjustwidth from the changepage package- see example below

\documentclass{article} \usepackage[showframe=true]{geometry} \usepackage{changepage} \usepackage{lipsum} \begin{document} \section{Regular settings} \lipsum \begin{adjustwidth}{2cm}{} \section{Adjusted settings} \lipsum \end{adjustwidth} \end{document} 

Note that the adjustwidth environment takes 2 arguments, the first is the indent from the left of the page, the second is the indent from the right of the page. I put showframe=true when I loaded the geometry package just for demonstration.

If you plan to use this idea at lots of different places throughout the document, it is probably worth defining your own environment, something like

\newenvironment{mywidth}{\begin{adjustwidth}{2cm}{}}{\end{adjustwidth}} 

which could then be used as

\begin{mywidth} \lipsum \end{mywidth} 

If your document is twosided then you can adjust the width different for even and odd sides- see the documentation for more details.

8

no need for a minipage, use a trivlist

\documentclass{article} \usepackage{lipsum} \begin{document} \section{foo} \begin{trivlist}\leftskip=2cm \item\relax\lipsum[1] \end{trivlist} \lipsum[1] \end{document} 

enter image description here

1
  • 9
    This works provided that no list based environment appears within this trivlist. \begin{list}{}{\leftmargin=2cm}...\end{list} wouldn't have this problem (and is the approach taken by adjustwidth). Commented Oct 25, 2011 at 21:35
2

For completion purpose, here comes another alternative that doesn't need any aditional package. Start a group in which you put the text to have the desired margins set as follows:

{ \leftskip=3cm %You can also use other units of glue. \rightskip=2cm This text will have margins adjusted for the parameters as desired. They specify glue to be inserted at the left and right of every line in a paragraph. Breakpages happens. After the group ends, the former margins are restored. You can also create a newenvironment for various uses of this. } 

Plain TeX also has the \narrower macro, described in the TeXbook, that increases both \leftskip and \rightskip by the current \parindent:

{\narrower\smallskip This paragraph will have narrower lines than the surrounding paragraphs do, because it uses the ``narrower'' feature of plain \TeX. The former margins will be restored after this group ends. This may be useful for quoting lengthy passages from a book.\smallskip } 

Note it is necessary to end the paragraph before ending the group with a blank line or a \par, for example, otherwise the effect disappear.

Reference and more information: Donald E. Knuth, The TEXbook, chapter 14 "How TeX Breaks Paragraphs into Lines".

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.