3

Consider the code:

\documentclass[12pt]{article} \usepackage{graphicx,wrapfig,lipsum} \begin{document} \thispagestyle{empty} \begin{wrapfigure}{r}{.20\linewidth} {\footnotesize{\textbf{\textit{This is a note. But I don't know what it is called.}}}} %\includegraphics[width=.65\linewidth,keepaspectratio]{example-image-golden} \end{wrapfigure} \noindent \lipsum[13] \end{document} 

which produces:

enter image description here

I am about to typeset a short document that has notes contained within the paragraphs such as what I have displayed. (I don't know the name for them.) For lack of a better term, I cam calling them "blocked notes"

I have basically done this by brute force---by replacing an image with text in a wrapfigure environment. I would like to make some modifications such as reducing the vertical space between the lines in the note; as well as modifying the vertical distance between the end of the note text and the actual paragraph.

QUESTION: Is there a better way to do this? If so, how?

Thank you.

2
  • 1
    relevant: \footnotesize does not take an argument and should be followed by a paragraph break. this is why the line spacing is wrong in the note: the text is footnote size but the paragraph is not. Commented 11 hours ago
  • could you create a custom environment for this, maybe based on wrapstuff? Commented 11 hours ago

2 Answers 2

4

In my opinion, it is perfectly reasonable to use wrapfig for inserting insets—not by replacing an image with text, but by explicitly treating the content as textual and manually adjusting the spacing.
Although wrapfig is not ideal, it works reliably for short insets when its parameters are set correctly.
For example, like this:

\documentclass[12pt]{article} \usepackage{wrapfig} \usepackage{lipsum} % Command for a right-side inset (text box) \newcommand{\blocknote}[1]{% \begin{wrapfigure}[4]{r}[0pt]{0.20\textwidth} % [4] – approximate number of lines; in this case, you can also try [3] \raggedright \footnotesize\itshape\bfseries \renewcommand{\baselinestretch}{0.85}\selectfont % reduce line spacing #1 \end{wrapfigure}% } \begin{document} \thispagestyle{empty} \blocknote{This is a note. But I don't know what it is called.} \lipsum[13] \end{document} 

enter image description here

Edit
There is an even more modern version of this package called 'wrapfig2' by Claudio Beccari. Here is an example showing how wrapfig2 works.

 \documentclass[12pt]{article} \usepackage{wrapfig2} \usepackage{lipsum} \begin{document} \thispagestyle{empty} \begin{wrapfigure}{r}{0.20\textwidth} \footnotesize\itshape\bfseries\raggedright This is a note. But I don't know what it is called. \end{wrapfigure} \lipsum[1] \end{document} 

enter image description here

3
  • I like wrapfig, but it is reliable only if you ensure you do not use wrapfigure in problematic places e.g. not near lists or headings etc. however, I much prefer its documentation ;). Commented 6 hours ago
  • @cfr thank you. wrapfig is a good old simple tool—and I think it’s still in demand. Its documentation is as modest as the tool itself :). But there is also wrapfig2... Commented 2 hours ago
  • Thank you kindly for these answers. Commented 6 mins ago
3

I wrote this answer earlier only to find you had deleted the question. Since you've undeleted it, I'm glad I didn't delete my answer.

I'm sure there must be a name, but I don't know what it is either.

I would recommend wrapstuff, but you could do the same with wrapfigure and a custom environment if you prefer. With wrapstuff you can set global defaults and override locally if required.

The other advantage of wrapstuff is that it is more robust than wrapfig and can be used in many cases where a wrapfigure would fail e.g. in proximity to lists etc.

\documentclass[12pt]{article} \usepackage{wrapstuff,lipsum} \wrapstuffset{% r, width=.2\linewidth, } \AddToHook{env/wrapstuff/begin}[dds] {% \footnotesize \bfseries \itshape } \begin{document} \thispagestyle{empty} \begin{wrapstuff}%[<option argument with local overrides>] This is a note. But I don't know what it is called. \end{wrapstuff} \noindent \lipsum[13] \end{document} 

inset blocked text

The main disadvantage of wrapstuff is the documentation1.

If you use wrapfig, note that you need a paragraph break at the end of wrapfigure to get the line-spacing correct. In your MWE, the line-spacing is wrong because the font is \footnotesize but the paragraph is set with \normalsize \baselineskip.

1It may be excellent documentation for all I know. Unfortunately, it is written in a language I cannot read. (I do not know which language.)

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.