6

I want to start a minipage, with the regular left-indentation, but to have its right margin adjusted with regular page right margin. An example of discrepancy:

\documentclass{article}
\usepackage[english]{babel}
\usepackage{blindtext}
\begin{document}
    \noindent\emph{Here is the regular text:}
    \par\smallskip\noindent
    \blindtext

    \par\medskip

    \noindent\emph{And here is the minipage:}
    \par\smallskip

    \begin{minipage}{\textwidth}
        \blindtext
    \end{minipage}
\end{document}
11

eTeX-Solution

Use

\begin{minipage}{\dimexpr\textwidth-\parindent\relax}

to subtract the regular indentation.

At this point I want to post the comment of Martin Scharrer:

\dimexpr awaits the expression directly without the square brackets{ }. It is a lower level (e-)TeX primitive, not a LaTeX macro. The \relax terminates the expression explicitly. It might work without it, but otherwise you have the risk that \dimexpr takes also some code following the expression inside the environment or macro as part of the expression.

package calc

Use

\usepackage{calc}
 ...
\begin{minipage}{\textwidth-\parindent}

to subtract the regular indentation.

LaTeX

Use

\newlength{\mywidth}
\setlength{\mywidth}{\textwidth}
\addtolength{\mywidth}{-\parindent}
 ...
\begin{minipage}{\mywidth}

to subtract the regular indentation.

TeX

Use

\newdimen\mywidth
\mywidth=\textwidth
\advance\mywidth by-\parindent
 ...
\begin{minipage}{\mywidth}

to subtract the regular indentation.

2
  • Thanks :-) I understand that \dimexpr enables to write length expressions after it. Shouldn't it have {}, like \dimexpr{\textwidth-\parindent}? and what does the ``relax'' do?
    – Andro
    Oct 3 '11 at 10:19
  • 1
    @Andro: No, \dimexpr awaits the expression directly without the { }. It is a lower level (e-)TeX primitive, not a LaTeX macro. The \relax terminates the expression explicitly. It might work without it, but otherwise you have the risk that \dimexpr takes also some code following the expression inside the environment or macro as part of the expression. Oct 3 '11 at 10:34

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.