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.

  • 2
    Welcome to TeX.SX! Please help us help you and add a minimal working example (MWE) that illustrates your problem. Reproducing the problem and finding out what the issue is will be much easier when we see compilable code, starting with \documentclass{...} and ending with \end{document}. – Rmano Apr 25 '16 at 10:08
  • Not easy: See also http://tex.stackexchange.com/questions/53702/wrapping-text-in-enumeration-environment-around-a-table, and http://tex.stackexchange.com/questions/59101/will-it-ever-be-possible-to-use-wrapfig-with-an-enumerate-or-itemize-environment – Rmano Apr 25 '16 at 10:24
  • Did you try adding the optional [t] to the minipages? Other than that, it can be done without minipages with some code involving the insbox set of plain macros. – Bernard Apr 25 '16 at 10:34

1 Answers1

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

Ulrike Fischer
  • 327,261