TransWikia.com

How to use lettrine and wrap text around an irregular shape in the same paragraph?

TeX - LaTeX Asked by alderman on May 12, 2021

Background:

Using the lettrine package, I can add a drop cap to the start of a paragraph. Also, using the cutwin package, I can wrap text around an irregular shape (c.f., this answer). However, when I combine the drop cap with the shaped cutout the drop cap moves outside of the margins and the image is covered with text (see the below screenshot and minimal working example).

How can I use a drop cap and wrap text around an irregular shape in the same paragraph?

(Note that my question is different than the question answered here as I am interested in wrapping text around an irregular shape as opposed to a rectangle)

Screenshot:

enter image description here

Minimal working example:

documentclass{article}

% fonts
usepackage{charter}
usepackage{courier}
usepackage[T1]{fontenc}

% lettrine and settings
usepackage{lettrine}
setlength{DefaultNindent}{0pt}
setlength{DefaultFindent}{1pt}

% cutwin for shaped text wrapping
usepackage{cutwin}

% tikz and tcolorbox to include picture as circle 
usepackage{tikz}
usetikzlibrary{calc}
usepackage[most]{tcolorbox}

usepackage{lipsum} % for dummy text only

begin{document}

% define shaped cutout
opencutright
newcommandMargins{%
    0.780textwidth, 
    0.745textwidth,
    0.730textwidth,
    0.717textwidth,
    0.712textwidth,
    0.712textwidth,
    0.717textwidth,
    0.730textwidth,
    0.755textwidth,
    0.795textwidth,
    1.0textwidth,
    1.0textwidth
}
renewcommand*{putstuffinpic}{%
put(0,-50){makebox(0,0){
    begin{tikzpicture}
        % one picture
        node[circle,draw=none,line width=1.5pt,inner sep=1.45cm,fill overzoom image*={clip,trim=1mm 1mm 1mm 1mm}{example-image-duck}] (A) {};
    end{tikzpicture}
    }}
}

% example with only lettrine
lettrine[lines=3]{H}{ow} to use lettrine with shaped text wrapping. lipsum[1-1]

vspace{2em}

% example with only shaped cutout
begin{shapedcutout}{0}{12}{Margins}
How to use lettrine with shaped text wrapping. lipsum[1-1]
end{shapedcutout}

vspace{2em}

% example that fails with lettrine and shaped cutout
begin{shapedcutout}{0}{12}{Margins}
lettrine[lines=3]{H}{ow} to use lettrine with shaped text wrapping. lipsum[1-1]
end{shapedcutout}

end{document}

One Answer

Not a complete answer but it may help. I couldnt have come up with anything if you hadn't provided an MWE, so thank you for that.

I must admit that I no longer really understand the lettrine code, nor cutwin even though I wrote some of it.

It seems that lettrine and cutwin clash when the cutout starts on the first line of the "lettrined" paragraph and I don't know what to do about that. However, if the cutout starts below the lettrined lines then all seems to be well. Below I have changed your MWE code for the clashed setting:

vspace{2em}
enlargethispage{1cm}
% example that fails with lettrine and shaped cutout
%begin{shapedcutout}{0}{12}{Margins}
lettrine[lines=3]{H}{ow} to use lettrine with shaped text wrapping.  % add a couple of lines
Second line 
Third line.
vspace{-0.3baselineskip} % reduce space between lettrined text and cutout text
begin{shapedcutout}{0}{12}{Margins}
noindent lipsum[1-1]
end{shapedcutout}

So, with a bit of fiddling you could get the appearance of a cutout in a lettrined paragraph provided it starts below the lettrining.

Hopefully someone else may be able to come up with a comprensevive solution.

Answered by Peter Wilson on May 12, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP