8

I'm trying to place a fleuron at the beginning of an indented paragraph without pushing the text of the first line forward.

I want the fleuron to be flush with the left margin of the paragraph, while preserving the indentation of the first line in the paragraph.

I have no idea how to do this. If I just place the fleuron before the paragraph, I get this result as expected:

enter image description here

Here's the code that produced this image:

\documentclass{article}
\usepackage{lipsum}
\usepackage{fontspec}
\newcommand{\fleuron}{{\setmainfont{HoeflerText-Fleurons}1}}
\setlength{\parindent}{1cm}

\begin{document}
\fleuron \lipsum[1]
\end{document}

With the magic of MS Paint, I've illustrated exactly what I want in my document:

enter image description here

What's the best way to accomplish this?

  • 3
    try this at the beginning of the paragraph: \leavevmode\kern-\parindent\rlap{<fleuron>}\kern\parindent\relax. (you have to be in vertical mode to start.) there are other ways, and maybe better ones, but this one is pretty straightforward. – barbara beeton May 26 '15 at 20:33
  • Thanks a lot @barbarabeeton, this worked. If it was in its own answer I wouldn't be sure whether to check yours or Werner's, because they both work and I'm not sure what the significant differences are between the two solutions. – Nickolas Peter O'Malley May 26 '15 at 20:40
  • 1
    @NickolasPeterO'Malley Don't do things such as \setmainfont for changing font mid-document; say \newfontface{\fleuronfont}{HoeflerText-Fleurons} in the preamble and \newcommand{\fleuron}{{\fleuronfont 1}} – egreg May 26 '15 at 22:02
9

You can set the fleuron as part of a zero-width box that stretches over \parindent:

enter image description here

\documentclass{article}
\usepackage[nopar]{lipsum}% Just for this example
\setlength{\parindent}{1cm}
\newcommand{\fleuron}{\textbullet}% My fleuron
\newcommand{\insertparfleuron}{\makebox[0pt][r]{\makebox[\parindent][l]{\fleuron}}}
\begin{document}
\insertparfleuron
\lipsum[1]

\lipsum[2]
\end{document}

\makebox enters TeX's horizontal mode, so necessarily starts the paragraph.

  • Thanks for this @Werner, this solved my issue. barbarabeeton's solution also worked, but I'm checking off this one for the sake of future readers. I'm unsure of the technical differences between the two solutions, so it might be useful to consider her solution as well. – Nickolas Peter O'Malley May 26 '15 at 20:42
  • 1
    @NickolasPeterO'Malley: They're similar, but different. barbarabeeton's solution uses more TeX macros, while mine uses LaTeX macros. \makebox[0pt][r]{..} is similar to \leavevmode\llap{..}, so I essentially have \leavevmode\llap{\rlap{<fleuron>}\kern\parindent} as \insertparfleuron. – Werner May 26 '15 at 20:54
7

May be simpler just write:

\noindent\rlap{...}\indent

Or ...

\noindent\makebox[1cm][l]{... }

Or automatically:

\everypar{\hspace{-1cm}\rlap{...}\indent}

MWE:

\documentclass{article}
\usepackage{lipsum}
\usepackage{fourier-orns}
\parindent1cm\parskip1em
\begin{document}
\noindent\rlap{\decotwo}\indent\lipsum[2]  % or ...
\noindent\makebox[1cm][l]{\decotwo}\lipsum[2]  % or ...
\everypar{\hspace{-1cm}\rlap{\decotwo}\indent}\lipsum[3-120]
\end{document}

MWE

But may be you want an automatically but obfuscated mode (you know, to confuse the enemy...) ;)

\everypar={\setbox0=\lastbox\hbox to 1cm\decotwo}
6

here's another method:

starting from vertical mode,

\leavevmode\kern-\parindent
\rlap{<fleuron>}%
\kern\parindent\relax

the mechanism is:
start the paragraph;
move left by the amount of the \parindent;
in a zero-width box, insert the fleuron;
move right by the amount of the \parindent.

(if you break this into several lines, as done here, don't forget the % that's needed to ignore the space from the line-ending.)

the complaint can be made that this isn't the "latex" way of doing things, but it is easy to follow (or derive) the steps, and it would work as well with plain tex.

note that in plain tex, \rlap does not get you out of vertical mode, hence the leftward space. (egreg assures me that the same definition is used for its latex implementation.)

  • So then, is this just another way of doing exactly what @Werner 's answer accomplishes? – Nickolas Peter O'Malley May 26 '15 at 20:51
  • 1
    yes; perhaps you can just consider it as looking at the problem "inside out". @Werner has given a good explanation from the latex perspective. – barbara beeton May 26 '15 at 20:56
  • @barbarabeeton \rlap in LaTeX is exactly the same as in Plain TeX. – egreg May 26 '15 at 22:03

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.