# cutwin, pstricks without defining the amount of lines OR how to have a small picture in the top left corner of a paragraph

I want a little image at the beginning of certain paragraphs that needs more than one line. In my case I like to have a quadratic picture needing 2 lines. So I tried to indent the 1st and 2nd line.

I have tried to solve this with a wrapfigure, but this had its own problems. Anyway, I have the most success with an approach using cutwin to define my own margins for the paragraph (see for example Text wrap with shapepar (insert image between text)).

After many tries I ended up with the following, which is nearly what I want.

\documentclass[10pt,a4paper, twocolumn, onepage]{report}
\usepackage[utf8]{inputenc}
\usepackage[demo]{graphicx}
\usepackage{wrapfig}

\usepackage{cutwin}
\usepackage{pstricks}

\usepackage{lipsum}

% cut for own flavor paragraph
\opencutleft
\newcommand*{\cutcut}{%
0.92\columnwidth,
0.92\columnwidth}
\renewcommand\putstuffinpic{%
\rput(0,-3pt){%
\includegraphics[width=0.05\textwidth, height=0.05\textwidth]{example.png}}}

% own flavor paragraph
\newenvironment{para}[1]{
\vspace{10pt}
\begin{shapedcutout}{0}{2}{\cutcut} \noindent
\textbf{#1}
}{
\end{shapedcutout}
}

\begin{document}

\chapter{Title}

\section{Title}

\lipsum[1]
\begin{para}{Title}
\lipsum[2]
\end{para}
\begin{para}{Title}
\lipsum[3]
\end{para}

Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt

\begin{para}{Title}
\lipsum[4]
\end{para}
\begin{para}{Title}
\lipsum[5]
\end{para}
\begin{para}{Title}
\lipsum[1]
\end{para}

\begin{para}{Title}
\lipsum[2]
\end{para}

Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt

\begin{para}{Title}
\lipsum[5]
\end{para}

\end{document}


However, it produces (sometimes) subtile spacing errors. In this example you can observe a wrong spacing between the 2nd and 3rd line of the second "para"-paragraph (and also in the following "para"-paragrpahs). You can observe this error in the given image. Its the paragraph that starts with "Title".

I agree that I don't use the cutwin package 100% correctly. I am supposed to define the margin of all lines and define the total number of lines. I just state a margin for the first 2 lines. However, I'd like to have a solution where I dont have to count lines manually. I am also happy with other approaches to my problem. Thanks a lot!

Edit: Concerning wrapfig / About Arash Esbati's suggestion:

Your code works. However, if I try this your code with an image in the wrapfigure, the images are moved down one line.

\documentclass[10pt,a4paper,twocolumn]{report}
\usepackage[utf8]{inputenc}
\usepackage{wrapfig,lipsum}
\usepackage[demo]{graphicx}

\begin{document}

\textbf{Title} \lipsum[2]

\noindent
\begin{wrapfigure}[2]{l}{20pt}
\includegraphics[width=0.05\textwidth, height=0.05\textwidth]{image.png}
%\vspace{-1\intextsep}\rule{20pt}{20pt}
\end{wrapfigure}
\textbf{Title} \lipsum[2]
\begin{wrapfigure}[2]{l}{20pt}
\includegraphics[width=0.05\textwidth, height=0.05\textwidth]{image.png}
%\vspace{-1\intextsep}\rule{20pt}{20pt}
\end{wrapfigure}\noindent
\textbf{Title} \lipsum[2]

\end{document}


I had the same problem when I tried to use wrapfig on my own.

• Welcome to here! – cfr Jul 24 '15 at 22:37

What are the problems you are facing when you use wrapfig? The following code works:

\documentclass[10pt,a4paper,twocolumn]{report}
\usepackage[utf8]{inputenc}
\usepackage{wrapfig,lipsum}

\begin{document}

\textbf{Title} \lipsum[2]

\noindent
\begin{wrapfigure}[2]{l}{20pt}
\vspace{-1\intextsep}\rule{20pt}{20pt}
\end{wrapfigure}
\textbf{Title} \lipsum[2]

\end{document}


Edit1:

I don't see the problem with:

\documentclass[10pt,a4paper,twocolumn]{report}
\usepackage[utf8]{inputenc}
\usepackage{wrapfig,lipsum,calc}
\usepackage{graphicx}

\begin{document}

\textbf{Title} \lipsum[2]

\begin{wrapfigure}[2]{l}{20pt}
\vspace{-1\intextsep}%
\includegraphics[height=20pt,keepaspectratio]{example-image-1x1}
\end{wrapfigure}
\noindent \textbf{Title} Lorem ipsum dolor sit amet, consetetur sadipscing
elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore
magna aliquyam erat, sed diam voluptua. At vero eos et accusam et
justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea
takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit
amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor
invidunt.

\end{document}


• Thanks for your answer. Your code works. However, if I put an image in the wrapfigure the images is one line below. I put the code I used into the main post. – g7529513 Jul 24 '15 at 14:40
• @g7529513 - See the edit to my answer. – Arash Esbati Jul 24 '15 at 22:18

I recommend using lettrine which is designed for this purpose. Although it is primarily designed for use with decorative initials and dropped capitals, it can also be used with images in place of letters. It assumes that your images will be named for the letters they replace in the initial word of the paragraph. However, provided you can rename your images freely, this is not too much of a problem provided you need no more than 26 different images for this purpose. In this case, I just created symbolic links rather than renaming images, so my images were named A.eps and X.png.

Then I can say:

\documentclass[10pt,a4paper,twocolumn]{report}
\usepackage[utf8]{inputenc}
\usepackage{lettrine,lipsum}
\usepackage{graphicx}
\renewcommand\LettrineTextFont{\bfseries}
\title{Title}
\author{}
\begin{document}
\maketitle% do NOT format this manually!

\lipsum[2]

\lettrine[image]{A}{ Title} % use image named A.eps or A.pdf or...
\lipsum[2]

\lettrine[image]{X}{ Title} % use image named X.eps or X.pdf or...
\lipsum[2]

\end{document}


to produce something like