16

How can I right align a minipage without using ragged2e?

Screenshot

enter image description here

MWE

\documentclass[12pt]{article}
\usepackage{ragged2e}

\usepackage{blindtext}

\begin{document}

\begin{minipage}{10cm}
\blindtext
\end{minipage}

\begin{flushright}
\begin{minipage}{10cm}
\blindtext
\end{minipage}
\end{flushright}

\end{document}
2

4 Answers 4

9

Without minipages that would produce odd interline spacing; also this allows page breaks.

\documentclass{article}
\usepackage{enumitem}
\usepackage{showframe,lipsum} % just for the example

\newenvironment{leftbox}[1]
 {\itemize[
    nosep,
    leftmargin=0pt,
    rightmargin=\dimexpr\textwidth-#1\relax,
    itemindent=\parindent,
    listparindent=\parindent,
  ]\item[]\relax}
 {\enditemize}

\newenvironment{rightbox}[1]
 {\itemize[
    nosep,
    leftmargin=\dimexpr\textwidth-#1\relax,
    rightmargin=0pt,
    itemindent=\parindent,
    listparindent=\parindent,
  ]\item[]\relax}
 {\enditemize}

\begin{document}

\lipsum[1]

\begin{leftbox}{10cm}
\lipsum[2]
\end{leftbox}

\begin{rightbox}{10cm}
\lipsum[3]
\end{rightbox}

\lipsum[4]

\end{document}

enter image description here

9

You can use an \hfill before the minipage:

\documentclass[12pt]{article}

\usepackage{blindtext}

\begin{document}

\begin{minipage}{10cm}
\blindtext
\end{minipage}

\hfill%
\begin{minipage}{10cm}
\blindtext
\end{minipage}

\end{document}
2
  • Is there another way of flushing the minpage to the right without using \begin{flushright}? Commented Dec 31, 2017 at 13:56
  • Oops, I'm still sleeping... you can insert an \hfill before the minipage. I'll fix it. Commented Dec 31, 2017 at 13:58
5

Is this what you want?

\documentclass[12pt]{article}

\usepackage{blindtext}

\begin{document}

\begin{minipage}{10cm}
\blindtext
\end{minipage}

\begin{flushright}
\begin{minipage}{10cm}
\raggedleft\blindtext
\end{minipage}
\end{flushright}

\end{document} 

enter image description here

3

You can use adjustbox to create the minipage and align it right, simply use minipage=10cm,right as keys. You might want to add some space (e.g. \medskip) between the paragraph before it because the result will be a hbox.

\documentclass[12pt]{article}
\usepackage{adjustbox}

\usepackage{blindtext}

\begin{document}

\begin{minipage}{10cm}
\blindtext
\end{minipage}

\medskip
\begin{adjustbox}{minipage=10cm, right}
\blindtext
\end{adjustbox}

\end{document}

enter image description here

1
  • 2
    This is the only answer that works inside enumerate. Useful for requirement elicitations Commented May 10, 2020 at 12:30

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .