Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

How does one write on the outside of a circle?

I am looking for sample files/packages which imitate a magazine lay-out. Specifically a page with two columns having a circular picture between the two columns.


Example of the desired layout, created using Word:

share|improve this question
3  
Possible duplicates: How do you create pull quotes?, Text wrap with shapepar (insert image between text). Although the former inserts text, it works similar for an image. If you want your shape to be non-rectilinear, like a circle say, the \parshape primitive can help. See the latter duplicate. –  Werner Apr 24 '12 at 2:21
2  
Another related question: Implementing a pullquotes algorithm in LaTeX. The solution I gave there can easily be adapted to a circular form if you can give some (mathematical) description of the circle's outline :-) –  Stephan Lehmke Apr 24 '12 at 4:54
7  
I'd like to point out this question shouldn't be closed as a duplicate! The referred answers are of two kinds: (a) making a circular insert in a single paragraph (b) making a rectangular insert between two columns. These are different enough that significant work is neccessary to combine the approaches. I'll try to make an answer tonight based on my pullquote approach. –  Stephan Lehmke Apr 24 '12 at 16:34
    
@StephanLehmke: Good point. Voted to reopen. –  Jake Apr 24 '12 at 16:49
    
@Jake This is just to say I'm working on a fully automated solution based on my other (rectangular) pullquote answer. So please wait til' weekend before giving the bounty (for the best answer of course). –  Stephan Lehmke Sep 4 '12 at 10:50

2 Answers 2

up vote 51 down vote accepted
+300

There is now a package pullquote which allows to create various shapes of inserts.

All you have to specify is the text which should "flow" plus some rectangular "object" which is inserted. Everything else is calculated automatically by the environment pullquote.

In principle, every shape can be defined by providing an appropriate shape function macro. See the package documentation.

Test example:

\documentclass{article}
\usepackage{tikz}
\usepackage{lipsum,xcolor,graphicx}
\usepackage{booktabs}
\usepackage[latin]{babel}

\usepackage{pullquote}

\usetikzlibrary{shapes,backgrounds,calc}

\makeatletter
\tikzset{circle split part fill/.style  args={#1,#2}{%
    alias=tmp@name, 
    postaction={%
      insert path={
        \pgfextra{% 
          \pgfpointdiff{\pgfpointanchor{\pgf@node@name}{center}}%
          {\pgfpointanchor{\pgf@node@name}{east}}%            
          \pgfmathsetmacro\insiderad{\pgf@x}
          \fill[#1] (\pgf@node@name.base) ([xshift=-\pgflinewidth]\pgf@node@name.east) arc
          (0:180:\insiderad-\pgflinewidth)--cycle;
          \fill[#2] (\pgf@node@name.base) ([xshift=\pgflinewidth]\pgf@node@name.west)  arc
          (180:360:\insiderad-\pgflinewidth)--cycle; }}}}}  
\makeatother  

\def\addquote
{%
  \Large
  \begin{tabular}[b]{p{5cm}}
    \midrule
    \textit{Wir m\"ussen wissen.}\        \textit{Wir werden wissen.}\        \mbox{}\hfill\large\textsc{David Hilbert}\        \midrule
  \end{tabular}%
}

\def\alicegraphic
{%
  \begin{tikzpicture}
    \clip (0,0) circle (2.7cm);
    \node (0,0) {\includegraphics[width=5cm]{alice}};
  \end{tikzpicture}%
}

\def\alicetext
{%
  They were indeed a queer-looking party that assembled on the bank--the birds with draggled feathers, the animals with their fur clinging close to them, and all dripping wet, cross, and uncomfortable.

  The first question of course was, how to get dry again: they had a consultation about this, and after a few minutes it seemed quite natural to Alice to find herself talking familiarly with them, as if she had known them all her life. Indeed, she had quite a long argument with the Lory, who at last turned sulky, and would only say, `I am older than you, and must know better'; and this Alice would not allow without knowing how old it was, and, as the Lory positively refused to tell its age, there was no more to be said.

  At last the Mouse, who seemed to be a person of authority among them, called out, `Sit down, all of you, and listen to me! I'll soon make you dry enough!' They all sat down at once, in a large ring, with the Mouse in the middle. Alice kept her eyes anxiously fixed on it, for she felt sure she would catch a bad cold if she did not get dry very soon.

  `Ahem!' said the Mouse with an important air, `are you all ready? This is the driest thing I know. Silence all round, if you please! "William the Conqueror, whose cause was favoured by the pope, was soon submitted to by the English, who wanted leaders, and had been of late much accustomed to usurpation and conquest. Edwin and Morcar, the earls of Mercia and Northumbria--"'

  `Ugh!' said the Lory, with a shiver.

  `I beg your pardon!' said the Mouse, frowning, but very politely: `Did you speak?'

  `Not I!' said the Lory hastily.

  `I thought you did,' said the Mouse. `--I proceed. "Edwin and Morcar, the earls of Mercia and Northumbria, declared for him: and even Stigand, the patriotic archbishop of Canterbury, found it advisable--"'

  `Found what?' said the Duck.

  `Found it,' the Mouse replied rather crossly: `of course you know what "it" means.'

  `I know what "it" means well enough, when I find a thing,' said the Duck: `it's generally a frog or a worm. The question is, what did the archbishop find?'

  The Mouse did not notice this question, but hurriedly went on, `"--found it advisable to go with Edgar Atheling to meet William and offer him the crown. William's conduct at first was moderate. But the insolence of his Normans--" How are you getting on now, my dear?' it continued, turning to Alice as it spoke.
}

\def\circlegraphic
{%
  \begin{tikzpicture}
    \huge 
    \node[name=s,
    shape=circle split,
    draw=gray!40,line width=2mm,
    circle split part fill={blue!50,red!50}
    ] at (5,5) {Big text\nodepart{lower} very big lower};
  \end{tikzpicture}%
}

\begin{document}
\begin{pullquote}{object={\includegraphics[width=3cm]{mill}}}
  \lipsum[1-3]
\end{pullquote}
\begin{pullquote}{object=\addquote}
  \lipsum[1-2]
\end{pullquote}
\begin{pullquote}{shape=circular,object=\alicegraphic}
  \alicetext
\end{pullquote}
\begin{pullquote}{shape=circular,object=\circlegraphic}
  \lipsum[1-3]
\end{pullquote}
\begin{pullquote}{shape=image,image=alice.png,imageopts={width=5cm}}
  \alicetext
\end{pullquote}
\begin{pullquote}{shape=image,image=duck1.pdf,imageopts={width=5cm}}
  \lipsum[1-3]
\end{pullquote}
\end{document}

example 1 example 2 example 3 example 4 example 5 example 6

I'd like to thank the user tohecz for providing a simple circle approximation formula which was easy to implement as an expandable TeX macro.

I took the circular TikZ graphic from an answer by Altermundus: TikZ - Two Colored Circle Split.

The last two examples use an experimental feature where the shape of the insert is automatically determined from the image shape. See an additional remark concerning this feature in an answer by Speravir: Pullquotes not working.

share|improve this answer
3  
Ah, really nice! Will the package be on CTAN soon? –  Gonzalo Medina Sep 4 '12 at 23:42
    
@GonzaloMedina At the moment it's in the "is this possible with TeX" stage. There are just so many restrictions that I see no real applications. OTOH, without somebody who has a clear perspective for really using this for something, I'm not really inclined to put in the enormous amount of work it would be to avoid some of the shortcomings. –  Stephan Lehmke Sep 4 '12 at 23:52
7  
+1. Excellent wizardry. Certainly this should go to CTAN –  Harish Kumar Sep 5 '12 at 0:25
    
Wow! This should go to "Ask and you shall receive" category! Any chance you could include bilingual examples especially with LTR+RTL support as in tex.stackexchange.com/questions/51957/… –  Maesumi Sep 14 '12 at 4:50
2  
@StephanLehmke, I noticed that the pullquote environment actually crates a two-column layout. When text goes after the environment, it switches to default. If the default option for the document is twocolumn, it doesn't behave as expected; if you use the multicols environment, it adds space between it and the text inside pullquote. I guess the pullquote environment is acting as a float or a minipage, which keeps it separated from the rest of the text. –  Joseph Dec 2 '12 at 15:53

I don't think there are automated approached for this kind of thing in LaTeX. The procedure I've implemented is based on trial-and-error and uses \parshape. Here are the steps I followed:

0. Preliminaries

\parshape <n> <i1> <w1> <i2> <w2> ... <in> <wn>

The first "argument" to \parshape represents the number of lines <n> that need to be adjusted. Subsequent "arguments" are pairs representing the indent <i_> and width <w_> of the lines.

Important to note is that \parshape only applies to the current paragraph. So, even if you specify a modification of (say) 10 lines in a paragraph containing only (say) 5, only 5 lines will be adjusted. Conversely, modifying (say) 10 lines in a paragraph containing (say) 15 lines will imply that the last modification holds until the end of the paragraph.

1. Draft

Insert the image in a rough location close to where you want it. I've used

\rlap{% Remove horizontal width
  \smash{% Remove vertical height
    \raisebox{-\height}{\includegraphics[height=12\baselineskip]{alice}}%
  }%
}%

enter image description here

What you should take note of is the lines in the left column affected by the image. There's about 14 lines affected. Note that you have to include an additional "last" line set to the entire column width to "restore" the width of the modified lines (in case the paragraph is not finished at that point).

2. Image relocation and paragraph shape

This is the laborious part.

  1. Move the image to the right/middle of the page (full column width + half of column width separation):

    \hspace{\dimexpr\columnwidth+.5\columnsep}
    
  2. Insert the \parshape indentation and width pairs. Also join subsequent paragraphs together using a \hfill\\ "paragraph break" and \indent combination. This extends the current paragraph to accommodate paragraph. Finally, correct for possible vertical mis-alignment introduced with the figure placement.

    \parshape 15 0pt \columnwidth% 1
      0pt \columnwidth% 2
      0pt 0.8\columnwidth% 3
      0pt 0.73\columnwidth% 4
      0pt 0.725\columnwidth% 5
      0pt 0.71\columnwidth% 6
      0pt 0.7\columnwidth% 7
      0pt 0.7\columnwidth% 8
      0pt 0.71\columnwidth% 9
      0pt 0.725\columnwidth% 10
      0pt 0.72\columnwidth% 11
      0pt 0.725\columnwidth% 12
      0pt 0.73\columnwidth% 13
      0pt 0.73\columnwidth% 14
      0pt \columnwidth% 15
    \rlap{% Remove horizontal width
      \smash{% Remove vertical height
        \hspace{\dimexpr\columnwidth+.5\columnsep}% Push content to middle of page
        \makebox[0pt][c]{% Centre image in middle of page
          % Drop image full height and scale to 12 lines high
          \raisebox{-\height}{\includegraphics[height=12\baselineskip]{alice}}%
        }%
      }%
    }\hfill%
    \\[-2\baselineskip]
    \indent At last the Mouse, who seemed to be a person of authority among them, called out, `Sit down, all of you, and listen to me! I'll soon make you dry enough!' They all sat down at once, in a large ring, with the Mouse in the middle. Alice kept her eyes anxiously fixed on it, for she felt sure she would catch a bad cold if she did not get dry very soon. \hfill \\
    \indent`Ahem!' said the Mouse with an important air, `are you all ready? This is the driest thing I know. Silence all round, if you please! "William the Conqueror, whose cause was favoured by the pope, was soon submitted to by the English, who wanted leaders, and had been of late much accustomed to usurpation and conquest. Edwin and Morcar, the earls of Mercia and Northumbria--"'
    

enter image description here

3. Fine-tuning

Duplicate the process above for the right column:

enter image description here

\documentclass[twocolumn]{article}
\usepackage{graphicx}% http://ctan.org/pkg/graphicx
\begin{document}
They were indeed a queer-looking party that assembled on the bank--the birds with draggled feathers, the animals with their fur clinging close to them, and all dripping wet, cross, and uncomfortable.
The first question of course was, how to get dry again: they had a consultation about this, and after a few minutes it seemed quite natural to Alice to find herself talking familiarly with them, as if she had known them all her life. Indeed, she had quite a long argument with the Lory, who at last turned sulky, and would only say, `I am older than you, and must know better'; and this Alice would not allow without knowing how old it was, and, as the Lory positively refused to tell its age, there was no more to be said.

\parshape 15 0pt \columnwidth% 1
  0pt \columnwidth% 2
  0pt 0.8\columnwidth% 3
  0pt 0.73\columnwidth% 4
  0pt 0.725\columnwidth% 5
  0pt 0.71\columnwidth% 6
  0pt 0.7\columnwidth% 7
  0pt 0.7\columnwidth% 8
  0pt 0.71\columnwidth% 9
  0pt 0.725\columnwidth% 10
  0pt 0.72\columnwidth% 11
  0pt 0.725\columnwidth% 12
  0pt 0.73\columnwidth% 13
  0pt 0.73\columnwidth% 14
  0pt \columnwidth% 15
\rlap{% Remove horizontal width
  \smash{% Remove vertical height
    \hspace{\dimexpr\columnwidth+.5\columnsep}% Push content to middle of page
    \makebox[0pt][c]{% Centre image in middle of page
      % Drop image full height and scale to 12 lines high
      \raisebox{-\height}{\includegraphics[height=12\baselineskip]{alice}}%
    }%
  }%
}\hfill%
\\[-2\baselineskip]
\indent At last the Mouse, who seemed to be a person of authority among them, called out, `Sit down, all of you, and listen to me! I'll soon make you dry enough!' They all sat down at once, in a large ring, with the Mouse in the middle. Alice kept her eyes anxiously fixed on it, for she felt sure she would catch a bad cold if she did not get dry very soon. \hfill \\
\indent`Ahem!' said the Mouse with an important air, `are you all ready? This is the driest thing I know. Silence all round, if you please! "William the Conqueror, whose cause was favoured by the pope, was soon submitted to by the English, who wanted leaders, and had been of late much accustomed to usurpation and conquest. Edwin and Morcar, the earls of Mercia and Northumbria--"'

`Ugh!' said the Lory, with a shiver.

`I beg your pardon!' said the Mouse, frowning, but very politely: `Did you speak?'

`Not I!' said the Lory hastily.

`I thought you did,' said the Mouse. `--I proceed. "Edwin and Morcar, the earls of Mercia and Northumbria, declared for him: and even Stigand, the patriotic archbishop of Canterbury, found it advisable--"'

`Found \textit{what}?' said the Duck.

`Found \textit{it},' the Mouse replied rather crossly: `of course you know what ``it'' means.'

`I know what "it" means well enough, when I find a thing,' said the Duck: `it's generally a frog or a worm. The question is, what did the archbishop find?'

The Mouse did not notice this question, but hurriedly went on, `"--found it advisable to go with Edgar Atheling to meet William and offer him the crown. William's conduct at first was moderate. But the insolence of his Normans--" How are you getting on now, my dear?' it continued, turning to Alice as it spoke.

`As wet as ever,' said Alice in a melancholy tone: `it doesn't seem to dry me at all.'

`In that case,' said the Dodo solemnly, rising to its feet, `I move that the meeting adjourn, for the immediate adoption of more energetic remedies--'

\parshape 15 0pt \columnwidth% 1
  0.05\columnwidth 0.95\columnwidth% 2
  0.1\columnwidth 0.9\columnwidth% 3
  0.2\columnwidth 0.8\columnwidth% 4
  0.25\columnwidth 0.75\columnwidth% 5
  0.28\columnwidth 0.72\columnwidth% 6
  0.29\columnwidth 0.71\columnwidth% 7
  0.3\columnwidth 0.7\columnwidth% 8
  0.3\columnwidth 0.7\columnwidth% 9
  0.31\columnwidth 0.69\columnwidth% 10
  0.31\columnwidth 0.69\columnwidth% 11
  0.3\columnwidth 0.7\columnwidth% 12
  0.29\columnwidth 0.71\columnwidth% 13
  0.25\columnwidth 0.75\columnwidth% 14
  0pt \columnwidth% 15
`Speak English!' said the Eaglet. `I don't know the meaning of half those long words, and, what's more, I don't believe you do either!' And the Eaglet bent down its head to hide a smile: some of the other birds tittered audibly.\hfill\\
\indent `What I was going to say,' said the Dodo in an offended tone, `was, that the best thing to get us dry would be a Caucus-race.'\hfill\\
\indent `What \textit{is} a Caucus-race?' said Alice; not that she wanted much to know, but the Dodo had paused as if it thought that \textit{somebody} ought to speak, and no one else seemed inclined to say anything.

`Why,' said the Dodo, `the best way to explain it is to do it.' (And, as you might like to try the thing yourself, some winter day, I will tell you how the Dodo managed it.)

First it marked out a race-course, in a sort of circle, (`the exact shape doesn't matter,' it said,) and then all the party were placed along the course, here and there. There was no `One, two, three, and away,' but they began running when they liked, and left off when they liked, so that it was not easy to know when the race was over. However, when they had been running half an hour or so, and were quite dry again, the Dodo suddenly called out `The race is over!' and they all crowded round it, panting, and asking, `But who has won?'

This question the Dodo could not answer without a great deal of thought, and it sat for a long time with one finger pressed upon its forehead (the position in which you usually see Shakespeare, in the pictures of him), while the rest waited in silence. At last the Dodo said, `\textit{Everybody} has won, and all must have prizes.'

`But who is to give the prizes?' quite a chorus of voices asked.

`Why, \textit{she}, of course,' said the Dodo, pointing to Alice with one finger; and the whole party at once crowded round her, calling out in a confused way, `Prizes! Prizes!'

Alice had no idea what to do, and in despair she put her hand in her pocket, and pulled out a box of comfits, (luckily the salt water had not got into it), and handed them round as prizes. There was exactly one a-piece all round.

`But she must have a prize herself, you know,' said the Mouse.

`Of course,' the Dodo replied very gravely. `What else have you got in your pocket?' he went on, turning to Alice.

`Only a thimble,' said Alice sadly.

`Hand it over here,' said the Dodo.

Then they all crowded round her once more, while the Dodo solemnly presented the thimble, saying `We beg your acceptance of this elegant thimble'; and, when it had finished this short speech, they all cheered.
\end{document}

Other options for image placement also exist and is possible using, for example, tikz, background, esopic and textpos.

Similar style implementations are described in How do you create pull quotes? and Text wrap with shapepar (insert image between text).

Text taken from Alice's Adventures in Wonderland (chapter III A Caucus-Race and a Long Tale).

share|improve this answer
    
Thank you very much for detailed instructions. This solution is robust enough for me to attempt some reverse engineering. How would you modify the set up to allow for bilingual parallel translation, especially for LTR+RTL combination? (Or should this be a separate question?) –  Maesumi Sep 14 '12 at 5:22
    
@Maesumi: Short answer: I don't know. I'm unfamiliar with any RTL typesetting, so I'm unsure about any complications, let alone a parallel translation. –  Werner Sep 14 '12 at 14:01

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.