Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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}
share|improve this question
add comment

1 Answer

up vote 10 down vote accepted

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.

share|improve this answer
    
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. –  Martin Scharrer Oct 3 '11 at 10:34
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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