3

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.

7

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

| improve this answer | |
  • 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! – Equivalent Triangle Apr 25 '16 at 12:18
  • Depends on the content of the other minipage. Where is its baseline? – Ulrike Fischer Apr 25 '16 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. – Equivalent Triangle Apr 25 '16 at 12:31
  • BTW, itemize sets the left margin using \leftskip, in which case \linewidth=\textwidth-\leftskip represents the remaining space. – John Kormylo Apr 25 '16 at 13:15
  • Extend my code with an small example diagram and include this in your question. – Ulrike Fischer Apr 25 '16 at 13:17

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.