13

How to insert a picture next to the itemize by wrapfig?? Like this: enter image description here

I try this:

\subsection*{1. Persona}
\begin{wrapfigure}[4]{r}{2.5in}
\centering
\includegraphics[width=2in]{fig/person.pdf}
\end{wrapfigure}

\begin{itemize}
\item \textbf{Jméno} - Adam
\item \textbf{Pohlaví} - muž
\item \textbf{Věk} - 21 let
\item \textbf{Stav} - svobodný, bezdětný
\item \textbf{Práce} - student vysoké školy (Vysoké učení technické fakulta podnikatelská)\end{itemize}`

But it looks bad:

enter image description here

Johannes_B
  • 24,235
  • 10
  • 93
  • 248
  • 3
    Welcome to TeX.SE. Have you read the wrapfig manual, especially the part that wrapfigure should not be used in list - like environment, e.g. itemize etc.? –  Jan 22 '17 at 12:10
  • Unfortunately, that isn't a strength of TeX. – Johannes_B Jan 22 '17 at 12:15
  • 1
    And is there any solution to my problem? Or not? – Marek Vrchlický Jan 22 '17 at 12:46
  • @MarekVrchlický http://tex.stackexchange.com/questions/59101/will-it-ever-be-possible-to-use-wrapfig-with-an-enumerate-or-itemize-environment might be helpful for you. – Masroor Jan 22 '17 at 12:57

2 Answers2

9

With package picins which is not part of TeXLive (license issue). Get it from CTAN: http://ctan.org/pkg/picins

\parpic(width,height)(x-offset,y-offset)[options][position]{image}

Only the {image} is mandatory, all other arguments are optional.

\documentclass{article}
\usepackage{picins}
\usepackage{graphicx}
\usepackage{blindtext}
\begin{document}
\subsection*{1. Persona}

\begin{itemize}
    \parpic(2in,1.5in)[r]{\includegraphics[width=2in]{tiger}}
    \item \textbf{Jméno} - Adam
    \item \textbf{Pohlaví} - muž
    \item \textbf{Věk} - 21 let
    \item \textbf{Stav} - svobodný, bezdětný
    \item \textbf{Práce} - student vysoké školy (Vysoké učení technické fakulta 
    podnikatelská)
    \item \blindtext    
\end{itemize}`

\blindtext
\end{document}

enter image description here

3

Here is a workaround, using enumitem and the insbox plain TeX macro package.

With enumitem, you can change the right margin of a list, choosing the number of items which correspond to the height of the graphics you want to insert, use the \InsertBoxR command before the list, then use the resume key in a new list. Some minor adjustment of vertical spacing between the two lists has to be done.

\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{lmodern}
\usepackage[showframe]{geometry}%
\usepackage{graphicx, enumitem}%
 \input{insbox}

\begin{document}

\subsection*{1. Persona}

Text text text text text text text text text text text text text. More text more text more text more text more text more text more text more text more text.

\begin{itemize}[before=\setlength{\rightmargin}{2in}\vspace*{-\dimexpr\topsep + \partopsep} \InsertBoxR{0}{\raisebox{-\dimexpr\height+\topsep+\partopsep+\baselineskip}[0pt][0pt]{\includegraphics{euclid}}}, after=\vspace{\dimexpr\itemsep-\topsep}] \item \textbf{Jméno} - Adam \item \textbf{Pohlaví} - muž \item \textbf{Věk} - 21 let \item \textbf{Stav} - svobodný, bezdětný \item \textbf{Práce} - student vysoké školy (Vysoké učení technické fakulta podnikatels \item \textbf{Stav} - svobodný, bezdětný \item \textbf{Práce} - student vysoké školy (Vysoké učení technické fakulta podnikatels \end{itemize} \begin{itemize}[topsep = 0pt]% \item \textbf{Práce} - student vysoké školy (Vysoké učení technické fakulta podnikatels \item \textbf{Práce} - student vysoké školy (Vysoké učení technické fakulta podnikatels \end{itemize}

\end{document}

enter image description here

Bernard
  • 271,350