1

I would like to place quotes in my document like in the template below. Ideally it would be a new environment that could be used multiple times easily. The quote should be halfway over the margin, in a bigger bold font to highlight key facts from the text.

Any idea how I could achieve this?

quote aside

  • Welcome to TeX.SX! Have you already tried something by yourself? For a quick solution, you put your quote inside a wrapfigure environment, instead of a picture as shown in how to text-wrap an image in latex. For what regards the margin overlapping, you could play around with real/fictional boxes dimensions. – ebosi Feb 2 '17 at 8:42
  • well, i came up with this: \begin{figure} \begin{quotation} this is the quote \end{quotation} \end{figure} but I don't know how to place the figure environment to the side and over the margin... – Mario Feb 2 '17 at 8:45
  • ok, thanks - wrapfig is not bad, but it doesn't overlap over the margin... – Mario Feb 2 '17 at 8:49
  • I've edited you title, so that your question focuses on your main issue only. (To use a bold typeface, just uses the \textbf{<text>} macro, and \textcolor{<color>}{<text>} (from the xcolor package) to change text color.) – ebosi Feb 2 '17 at 10:33
4

You can use the wrapfigure environment (from wrapfig package). This environment creates a box making the main text wrap around it. You can specify the width of this box and its position (left, or right, as well as inside, or outside for double-sided documents). Moreover, this package natively include the specification of the overhanging width.

\begin{wrapfigure}{<position: l, r, i, or o>}[<overhang width>]{<total width of the wrapfigure>}
    <content of the wraping figure>
\end{wrapfigure}

enter image description here

\documentclass{article}
    \usepackage{lipsum}
    \usepackage{wrapfig}
    \usepackage{xcolor}

\begin{document}
    \lipsum[1]
    \begin{wrapfigure}{r}[.1\textwidth]{.4\textwidth}%
            \textbf{\sffamily\Large\textcolor{blue!50!black}{``Good things might come to those who wait\dots''}}%
    \end{wrapfigure}
    \lipsum[2-3]
\end{document}

enter image description here


Original answer

This solution uses a parbox inside the wrapfigure, instead of the native overhang option of wrapfig. It is thus bulkier than the one suggested above in the edit.

This solution uses the wrapfigure environment (from wrapfig package). This package defines a floating box that the text wraps around. You can specify the width of this box and its position (left or right):

\begin{wrapfigure}{<position: R or L>}{<width of the wrapfigure>}
    <content of the wraping figure>
\end{wrapfigure}

We fill this box with our quote. In order to make the text run across the margin, we put this text inside another box, a parbox, having a wider width than the one defined by the wrapfigure environment:

\parbox{<width of the box>}{<content of the box>}

enter image description here


\documentclass{article}
    \usepackage{lipsum}
    \usepackage{graphicx}
    \usepackage{wrapfig}
    \usepackage{xcolor}

\begin{document}
    \lipsum[1]
    \begin{wrapfigure}{R}{.2\textwidth}%
        \parbox{.4\textwidth}{%
            \textbf{\sffamily\Large\textcolor{blue!50!black}{``Good things might come to those who wait\dots''}}%
        }%
    \end{wrapfigure}
    \lipsum[2-3]
\end{document}

MWE with explicit boxes:

enter image description here

\documentclass{article}
    \usepackage{lipsum}
    \usepackage{graphicx}
    \usepackage{wrapfig}
    \usepackage{showframe}

\begin{document}
    \lipsum[1]
    \begin{wrapfigure}{R}{.2\textwidth}%
        \fbox{\parbox{.3\textwidth}{\textbf{\Large Good things might come to those who wait\dots}}}%
    \end{wrapfigure}
    \lipsum[2-3]
\end{document}
  • great thanks! however, there is a problem if there are other graphics, the wrapfigure is behind it and not closed... like this: dropbox.com/s/0329olwdno10uyr/… if there is no graphic following, it works nicely... – Mario Feb 2 '17 at 9:12
  • @Mario I've edited my answer: the wrapfigure environment has an optional argument than makes the use of a parbox superfluous – ebosi Feb 2 '17 at 10:15
  • great, now it really works nicely. just one last thing: now the quote is always at the top of a paragraph. is it possible to place in the middle of a long paragraph? – Mario Feb 2 '17 at 10:21
  • @Mario wrapfig documentation states on page 2: "It is convenient to begin the environment between paragraphs, but if you want placement in the middle of a paragraph, you must put the environment between two words where there is a natural line break" – ebosi Feb 2 '17 at 10:26

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.