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}
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}
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}
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?.
\centerline is deprecated in LaTeX (at least according to the l2tabu document).
– mhp
Apr 13 '12 at 13:18
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
I was putting parcolumns and verbatim blocks inside my minipage which was causing problems. I found this rather simple solution quite effective:
\noindent\hspace{0.15\linewidth}\begin{minipage}{0.7\linewidth}
...
\end{minipage}
This creates a smaller minipage and centres with a positive hspace. Using the rule hspace = (1\linewidth - minipage_width) / 2 will also work for values larger than \linewidth and produce a negative hspace:
\newlength{\myminipagewidth}
\newlength{\myminipagecentering}
\setlength{\myminipagewidth}{1.5\linewidth} %change this
\setlength{\myminipagecentering}{(\linewidth-\myminipagewidth)/2}
\noindent\hspace{\myminipagecentering}\begin{minipage}{\myminipagewidth}
...
\end{minipage}
(sub \linewidth with \textwidth when needed)
Very simple, enclose that minipage in center using \begin{center} and \end{center} as shown below:
\begin{center}
\noindent\begin{minipage}{1.5\textwidth}
text
\end{minipage}
\end{center}
center environment will not center content that is wider than the textwidth. `\documentclass{article}
\usepackage{lipsum}
\begin{document}
\lipsum[1]
\begin{center}
\begin{minipage}{1.5\textwidth} \lipsum[4] \end{minipage}
\end{center} \lipsum[4] \end{document}` will result in https://i.stack.imgur.com/ZdtEI.png
– leandriis Mar 22 '20 at 11:22
\linewidthshould be used instead of\textwidthper this post about the difference between these two – Peter Grill May 18 '11 at 03:38\textwidthand 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 04:02msupertabularenvironment. – juanuni May 21 '15 at 05:24