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.

The left margin is too wide if I set 1.5\textwidth:

\begin{document}

\noindent\begin{minipage}{1.5\textwidth}

test

\end{minipage}

\end{document}
share|improve this question
add comment

2 Answers

up vote 11 down vote accepted

Put it inside a centered box

\documentclass{article}
\begin{document}
\noindent\hrulefill\par
\noindent\makebox[\textwidth][c]{%
    \begin{minipage}{1.5\textwidth}
        \hrulefill\par
    \end{minipage}}
\end{document}
share|improve this answer
    
I think \linewidth should be used instead of \textwidth per this post about the difference between these two –  Peter Grill May 18 '11 at 3:38
    
@Peter Grill: The OP asked for \textwidth and it is difficult to say without context what it is used for. If you are looking for a fixed global width it is \textwidth. If the widths need to change with local column, environment of box width, then use \linewidth –  Danie Els May 18 '11 at 4:02
add comment

A simple way to do this is to use \centerline{..} around the minipage. (This does not allow for verbatim or similar special content, but there is a \Centerline variant from the realboxes package, which does!)

I would add some small or medium vertical skip before and after this minipage to get decent vertical spacing.

\documentclass{article}
\usepackage{lipsum}% dummy text
\begin{document}

\lipsum[1]

\par\smallskip\noindent
\centerline{\begin{minipage}{1.5\textwidth}
\lipsum[2]
\end{minipage}}
\par\smallskip

\lipsum[3]

\end{document}

Another easy way is to use the adjustbox environment from the package with the same name. It provides the keys minipage=<minipage args>, center(=<length>, normally \linewidth) and also margin(=<left/right> <top/bottom>, and more).

\documentclass{article}
\usepackage{adjustbox}
\usepackage{lipsum}% dummy text
\begin{document}

\lipsum[1]

\begin{adjustbox}{minipage=1.5\textwidth,margin=0pt \smallskipamount,center}
\lipsum[2]
\end{adjustbox}

\lipsum[3]

\end{document}

Compare the similar question and answers at How can I center a too wide table?.

share|improve this answer
    
It should be noted that using \centerline is deprecated in LaTeX (at least according to the l2tabu document). –  mhp Apr 13 '12 at 13:18
1  
@mhp: Thanks, I was not aware of that. I find it very useful from time to time. Looking at l2tabu it stated that it should not be used to center text, because it e.g. can cause issues when used inside lists. I think it is fine for this case, i.e. a large block in a paragraph of it's own. –  Martin Scharrer Apr 13 '12 at 13:19
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.