1

I'd like to place a minipage inside an enumerate/itemize environment and it respecting the right margin of the page, as {\textwidth} makes it go over the margin, is there any way to do this other than manually checking the exact length available for text? Maybe some way to substract the indent value from the \textwidth

Also, it would be great if it worked with the same command for multiple nested enumerates, as I'm currently using this command for the items on my enumerates:

\newcommand{\ej}[1]{
\item \begin{minipage}[t]{\textwidth}
{#1}

\end{minipage} }

Thanks!

1
  • 1
    It should work with \begin{minipage}{\linewidth}.
    – Bernard
    Aug 8, 2020 at 17:53

2 Answers 2

2

Just use \linewidth in the place of \textwidth:

\documentclass{article}
\usepackage{lipsum}

\begin{document}

\lipsum[11]
\begin{itemize}
    \item \begin{minipage}[t]{\linewidth}
            \lipsum[12]
        \end{minipage}
    \item \begin{minipage}[t]{\linewidth}
            \lipsum[13]
        \end{minipage}
\end{itemize}

\end{document} 

enter image description here

0
1

Maybe you are looking for something like this:

\documentclass{article}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{lipsum}
%\overfullrule=5pt
\begin{document}
\lipsum[1]
\begin{itemize}
    \item \begin{minipage}[t]{\dimexpr\textwidth-\leftmargin-\parindent\relax}
            {\lipsum[1]}
        \end{minipage}
    \item \begin{minipage}[t]{\dimexpr\textwidth-\leftmargin-\parindent\relax}
            {\lipsum[2]}
        \end{minipage}
\end{itemize}
\lipsum[3]
\end{document}

enter image description here

2
  • 1
    \linewidth is easier Aug 8, 2020 at 19:34
  • @DavidCarlisle you're right!
    – Rmano
    Aug 8, 2020 at 19:43

You must log in to answer this question.

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