4

Sometimes I wish to include a small diagram next to the text which I could achieve by using two mini-page, one for the text, one for the diagram. However when I use it inside itemize, the bullet point gone to the wrong place (see diagram). How can I make it so that the bullet point is in the right place (ie. next to "An")enter image description here

In response to Ulrike Fischer's answer, for example the code

\documentclass{article}
\usepackage{tikz}

\begin{document}
\begin{itemize}
\item blbl

\item \begin{minipage}{4cm} some text\\some text\\some text\end{minipage}

\item \begin{minipage}[t]{4cm} some text\\some text\\some text\\some text\\some text\end{minipage}
\begin{minipage}[t]{4cm}   
  \begin{center}
    \begin{tikzpicture}
      \draw [->] (-1,-1) -- (1,-1) -- (1, 1) -- (-1, 1) -- (-1,-1);
    \end{tikzpicture}
  \end{center}
\end{minipage}

\item \begin{minipage}[t]{4cm} some text\\some text\\some text\\some text\\some text\end{minipage}
\begin{minipage}{4cm}   
  \begin{center}
    \begin{tikzpicture}
      \draw [->] (-1,-1) -- (1,-1) -- (1, 1) -- (-1, 1) -- (-1,-1);
    \end{tikzpicture}
  \end{center}
\end{minipage}

\end{itemize}
\end{document}

gives

enter image description here

so the tikz diagram is not next to the text.

3

1 Answer 1

8

Use the [t] option to align your minipage at the first line:

\documentclass{article}

\begin{document}
\begin{itemize}
\item blbl

\item \begin{minipage}{4cm} some text\\some text\\some text\end{minipage}

\item \begin{minipage}[t]{4cm} some text\\some text\\some text\end{minipage}

\end{itemize}
\end{document}

enter image description here

Edit

You can align the following minipage with the tikzpicture e.g. with a \vspace or by using the baseline key of tikzpicture:

\documentclass{article}
\usepackage{tikz}

\begin{document}
\begin{itemize}
\item blbl

\item \begin{minipage}{4cm} some text\\some text\\some text\end{minipage}

\item \begin{minipage}[t]{4cm} some text\\some text\\some text\\some text\\some text\end{minipage}%
\begin{minipage}[t]{4cm}
     \centering
     \begin{tikzpicture}[baseline={(1,1)}] %or some other coordinate
      \draw [->] (-1,-1) -- (1,-1) -- (1, 1) -- (-1, 1) -- (-1,-1);
    \end{tikzpicture}
\end{minipage}

\item \begin{minipage}[t]{4cm} some text\\some text\\some text\\some text\\some text\end{minipage}%
\begin{minipage}[t]{4cm}
 \centering
 \vspace{-\ht\strutbox} %or some other value.
     \begin{tikzpicture}
      \draw [->] (-1,-1) -- (1,-1) -- (1, 1) -- (-1, 1) -- (-1,-1);
    \end{tikzpicture}
\end{minipage}

\end{itemize}
\end{document}

enter image description here

7
  • I tried this but then the other mini-page containing the diagram went to the wrong place (i.e. not on the same level as the mini-page containing the text) How could I fixed it? Thanks! Commented Apr 25, 2016 at 12:18
  • Depends on the content of the other minipage. Where is its baseline? Commented Apr 25, 2016 at 12:22
  • Sorry I am new to Latex, not sure what baseline exactly is. The other mini-page usually contains a tikz diagram and the diagram are meant to be next to the text. Commented Apr 25, 2016 at 12:31
  • BTW, itemize sets the left margin using \leftskip, in which case \linewidth=\textwidth-\leftskip represents the remaining space. Commented Apr 25, 2016 at 13:15
  • Extend my code with an small example diagram and include this in your question. Commented Apr 25, 2016 at 13:17

You must log in to answer this question.

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