带圆形插入的双栏文本

带圆形插入的双栏文本

如何在圆圈外面写字?

我正在寻找模仿杂志布局的示例文件/包。具体来说,是一页有两列,两列之间有一张圆形图片。


使用 Word 创建的所需布局示例:

答案1

现在有一个包引文这使得能够创建各种形状的插入件。

您只需指定应“流动”的文本以及插入的某个矩形“对象”。其他所有内容均由环境自动计算pullquote

原则上,每个形状都可以通过提供适当的形函数宏。请参阅包文档。

测试示例:

\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@[email protected]) ([xshift=-\pgflinewidth]\pgf@[email protected]) arc
          (0:180:\insiderad-\pgflinewidth)--cycle;
          \fill[#2] (\pgf@[email protected]) ([xshift=\pgflinewidth]\pgf@[email protected])  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}

示例 1 示例 2 示例 3 示例 4 示例 5 示例 6

我想感谢用户托黑茨提供了一个简单的圆近似公式,该公式很容易作为可扩展的 TeX 宏实现。

我从 Altermundus 的回答中截取了圆形 TikZ 图形:TikZ - 两种颜色的圆圈分割

最后两个示例使用了一个实验性功能,其中插入的形状是根据图像形状自动确定的。请参阅 Speravir 的回答中有关此功能的附加注释:引文不起作用

答案2

我认为 LaTeX 中没有针对此类事情的自动化方法。我实施的程序基于反复试验并使用\parshape。以下是我遵循的步骤:

0. 准备工作

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

第一个“参数”表示需要调整的\parshape行数。后续“参数”是成对的,表示行的缩进和宽度。<n><i_><w_>

需要注意的是,\parshape仅适用于当前的段落。因此,即使您在仅包含 5 行的段落中指定修改 10 行,也只会调整 5 行。相反,在包含 15 行的段落中修改 10 行,则意味着最后一次修改将保留到段落结束。

1. 草案

将图像插入到您想要的大致位置附近。我使用过

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

在此处输入图片描述

您应该注意左列中受图像影响的行。受影响的行大约有 14 行。请注意,您必须添加一个设置为整个列宽的附加“最后”行,以“恢复”修改后的行的宽度(以防段落在此时尚未完成)。

2. 图像重定位和段落形状

这是最费力的部分。

  1. 将图像移动到页面的右侧/中间(全列宽 + 一半列宽分隔):

    \hspace{\dimexpr\columnwidth+.5\columnsep}
    
  2. 插入\parshape缩进和宽度对。同时使用\hfill\\“段落分隔符”和\indent组合将后续段落连接在一起。这会扩展当前段落以容纳段落。最后,纠正因图形放置而可能出现的垂直错位。

    \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--"'
    

在此处输入图片描述

3. 微调

对右列重复上述过程:

在此处输入图片描述

\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}

还存在其他图像放置选项,例如,tikzbackgroundesopictextpos

类似风格的实现在如何创建引言?文字换行shapepar(在文本之间插入图片)

文字摘自爱丽丝梦游仙境(章节三、党团竞选与长篇故事)。

相关内容