Poetry, calligrams and TikZ/PStricks challenge
One of my favorite poets is probably Guillaume Apollinaire. His story and proximity to Picasso made him a precursor. Calligrams was a constant attempt to merge poetry and visual. I am wondering how we could actually recreate in TikZ
tikz-pgf pstricks poetry
add a comment |
One of my favorite poets is probably Guillaume Apollinaire. His story and proximity to Picasso made him a precursor. Calligrams was a constant attempt to merge poetry and visual. I am wondering how we could actually recreate in TikZ
tikz-pgf pstricks poetry
1
There’s one example of concrete poetry at tex.stackexchange.com/a/193563 I’m not persuaded thattikz
is the best tool for this.
– Thérèse
4 hours ago
1
A fine challenge! Personally, I'd like to try La colombe poignardée et le jet d'eau, but would prefer to do it withpstricks
.
– Bernard
4 hours ago
@Bernard oh this one is very pretty too !! I had it to my initial question
– Julien-Elie Taieb
4 hours ago
@Thérèse I am not sure I agree: tex.stackexchange.com/a/68740/121799.
– marmot
3 hours ago
See also: tex.stackexchange.com/a/403353/48
– ShreevatsaR
3 hours ago
add a comment |
One of my favorite poets is probably Guillaume Apollinaire. His story and proximity to Picasso made him a precursor. Calligrams was a constant attempt to merge poetry and visual. I am wondering how we could actually recreate in TikZ
tikz-pgf pstricks poetry
One of my favorite poets is probably Guillaume Apollinaire. His story and proximity to Picasso made him a precursor. Calligrams was a constant attempt to merge poetry and visual. I am wondering how we could actually recreate in TikZ
tikz-pgf pstricks poetry
tikz-pgf pstricks poetry
edited 4 hours ago
Julien-Elie Taieb
asked 4 hours ago
Julien-Elie TaiebJulien-Elie Taieb
20519
20519
1
There’s one example of concrete poetry at tex.stackexchange.com/a/193563 I’m not persuaded thattikz
is the best tool for this.
– Thérèse
4 hours ago
1
A fine challenge! Personally, I'd like to try La colombe poignardée et le jet d'eau, but would prefer to do it withpstricks
.
– Bernard
4 hours ago
@Bernard oh this one is very pretty too !! I had it to my initial question
– Julien-Elie Taieb
4 hours ago
@Thérèse I am not sure I agree: tex.stackexchange.com/a/68740/121799.
– marmot
3 hours ago
See also: tex.stackexchange.com/a/403353/48
– ShreevatsaR
3 hours ago
add a comment |
1
There’s one example of concrete poetry at tex.stackexchange.com/a/193563 I’m not persuaded thattikz
is the best tool for this.
– Thérèse
4 hours ago
1
A fine challenge! Personally, I'd like to try La colombe poignardée et le jet d'eau, but would prefer to do it withpstricks
.
– Bernard
4 hours ago
@Bernard oh this one is very pretty too !! I had it to my initial question
– Julien-Elie Taieb
4 hours ago
@Thérèse I am not sure I agree: tex.stackexchange.com/a/68740/121799.
– marmot
3 hours ago
See also: tex.stackexchange.com/a/403353/48
– ShreevatsaR
3 hours ago
1
1
There’s one example of concrete poetry at tex.stackexchange.com/a/193563 I’m not persuaded that
tikz
is the best tool for this.– Thérèse
4 hours ago
There’s one example of concrete poetry at tex.stackexchange.com/a/193563 I’m not persuaded that
tikz
is the best tool for this.– Thérèse
4 hours ago
1
1
A fine challenge! Personally, I'd like to try La colombe poignardée et le jet d'eau, but would prefer to do it with
pstricks
.– Bernard
4 hours ago
A fine challenge! Personally, I'd like to try La colombe poignardée et le jet d'eau, but would prefer to do it with
pstricks
.– Bernard
4 hours ago
@Bernard oh this one is very pretty too !! I had it to my initial question
– Julien-Elie Taieb
4 hours ago
@Bernard oh this one is very pretty too !! I had it to my initial question
– Julien-Elie Taieb
4 hours ago
@Thérèse I am not sure I agree: tex.stackexchange.com/a/68740/121799.
– marmot
3 hours ago
@Thérèse I am not sure I agree: tex.stackexchange.com/a/68740/121799.
– marmot
3 hours ago
See also: tex.stackexchange.com/a/403353/48
– ShreevatsaR
3 hours ago
See also: tex.stackexchange.com/a/403353/48
– ShreevatsaR
3 hours ago
add a comment |
1 Answer
1
active
oldest
votes
This is just to mention that TikZ has already built in a large selection of tricks that can be applied to paths. Here is a very basic example. (Yes, I know I am not a poet.;-)
documentclass[tikz,border=3.14mm]{standalone}
usetikzlibrary{decorations.text}
begin{document}
begin{tikzpicture}
defmypath{
(-2,0) to[bend right=10] (0,5.1)
to[bend right=10] (2,0) -- (1.5,0) -- (0.8,1) -- (-0.8,1) -- (-1.5,0) -- cycle}
draw mypath;
path[decorate,decoration={text along path,
text={In Paris there is a tower and beneath it there grows a flower. And often
on Mondays there is a shower.}}] mypath;
end{tikzpicture}
end{document}
The IMHO most stunning tools are however not from the pgfmanual, but due to Paul Gaborit's great answer. You basically define the contour and the macro takes care of the rest. (Of course, you may want to tune things in the end a bit, but it is stunning how much it does out of the box.)
documentclass{standalone}
usepackage{lmodern}
usepackage[T1]{fontenc}
usepackage{shapepar}
usepackage{microtype}
usepackage{lipsum}
usepackage{tikz}
usetikzlibrary{calc,fit,intersections}
defshapeparnodeaccuracy{2}
newcommandshapeparnode[6]{
% 6 parameters:
% style for node (default:empty),
% h margin, v margin, left path, right path, text (just one paragraph!)
% name left and right paths and compute there bounding boxes
begin{scope}[local bounding box=leftbb]
path[name path global=left,xshift=#2] #4;
end{scope}
node[inner ysep=-#3,inner xsep=0pt,fit=(leftbb)](leftbb){};
begin{scope}[local bounding box=rightbb]
path[name path global=right,xshift=-#2] #5;
end{scope}
node[inner ysep=-#3,inner xsep=0pt,fit=(rightbb)](rightbb){};
% global bounding box
path let
p1=(leftbb.north west), p2=(leftbb.south west),
p3=(rightbb.north east), p4=(rightbb.south east)
in
pgfextra{
pgfmathsetmacro{ymin}{(y1 < y3) ? y1 : y3}
pgfmathsetmacro{ymax}{(y2 > y4) ? y2 : y4}
typeout{ymin ymin}
typeout{ymax ymax}
} node[inner sep=0,fit={(x1,ymin pt)(x3,ymax pt)}](mybb){};
% compute nb steps
path let p1=(mybb.north), p2=(mybb.south) in
pgfextra{
pgfmathsetmacro{fnthght}{1em/shapeparnodeaccuracy}
pgfmathtruncatemacro{nbsteps}{(y1-y2)/fnthght}
xdefnbsteps{nbsteps}
typeout{nb steps nbsteps}
};
% horizontal references
path (mybb.north) -- (mybb.south)
foreach cnt in {0,1,...,nbsteps}{
pgfextra{pgfmathsetmacro{pos}{cnt/nbsteps}}
coordinate[pos=pos] (ref cnt)
};
% left and right boundaries coordinates
foreach cnt in {0,1,...,nbsteps}{
% an horizontal line from left to right
path[name path=ltor]
(mybb.west |- ref cnt) -- (mybb.east |- ref cnt);
% same line from right to left
path[name path=rtol]
(mybb.east |- ref cnt) -- (mybb.west |- ref cnt);
% left boundary
path[name intersections={of=rtol and left,by={l cnt},sort by=rtol}];
% right boundary
path[name intersections={of=ltor and right,by={r cnt},sort by=ltor}];
}
% start point (and initial value of boundshape)
path let p1=(l 0) in
pgfextra{
pgfmathsetmacro{xstart}{x1}
xdefboundshape{{0}{0}b{xstart}}
xdefxmin{xstart}
xdefxmax{xstart}
};
% top and bottom
path let p1=(l 0), p2=(l nbsteps) in
pgfextra{
pgfmathsetmacro{ystart}{y1}xdefystart{ystart}
pgfmathsetmacro{yending}{y2}xdefyending{yending}
};
% incremental definition of boundshape
foreach cnt in {0,1,...,nbsteps}{
path let p1=(l cnt), p2=(r cnt) in
pgfextra{
pgfmathsetmacro{start}{x1}
pgfmathsetmacro{len}{x2-x1}
pgfmathsetmacro{ypos}{cnt/nbsteps*(ystart - yending)}
{let\=relax xdefboundshape{boundshape\{ypos}t{start}{len}}}
pgfmathsetmacro{xmin}{(xmin < start) ? xmin : start}
xdefxmin{xmin}
pgfmathsetmacro{xmax}{(xmax > start + len) ? xmax : start + len}
xdefxmax{xmax}
};
}
% draw the node with text in a shapepar
pgfmathsetmacro{ymax}{ystart - yending}
{let\=relax xdefboundshape{boundshape\{ymax}e{0}}}
node[#1,text width=xmax pt - xmin pt,align=flush left,
anchor=north west,inner sep=0]
at (mybb.north west -| xmin pt,0)
{Shapepar[1pt]{boundshape}#6par};
}
defmytext{In Paris there is a tower and beneath it there grows a flower.}
begin{document}%
begin{tikzpicture}
defpathone{(0,1) -- (-0.8,1) -- (-1.5,0) --
(-2,0) to[bend right=10] (0,5.1)}
defpathtwo{(0,5.1)
to[bend right=10] (2,0) -- (1.5,0) -- (0.8,1) -- (-0.8,1)}
fill[top color=lime,bottom color=orange,middle color=yellow,draw=white]
pathone -- pathtwo -- cycle;
defpathone{(0,1) -- (-0.8,1) -- (-1.5,0) --
(-1.6,0) to[bend right=10] (0,4.1)}
defpathtwo{(0,4.1)
to[bend right=10] (1.6,0) -- (1.5,0) -- (0.8,1) -- (-0.8,1)}
shapeparnode[text=black,font=footnotesizescshape]
{0.1em}{0.1em}{pathone}{pathtwo}{mytext}%
%draw[orange] pathone;
%draw[orange] pathtwo;
end{tikzpicture}
end{document}
add a comment |
Your Answer
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "85"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2ftex.stackexchange.com%2fquestions%2f482345%2fpoetry-calligrams-and-tikz-pstricks-challenge%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
This is just to mention that TikZ has already built in a large selection of tricks that can be applied to paths. Here is a very basic example. (Yes, I know I am not a poet.;-)
documentclass[tikz,border=3.14mm]{standalone}
usetikzlibrary{decorations.text}
begin{document}
begin{tikzpicture}
defmypath{
(-2,0) to[bend right=10] (0,5.1)
to[bend right=10] (2,0) -- (1.5,0) -- (0.8,1) -- (-0.8,1) -- (-1.5,0) -- cycle}
draw mypath;
path[decorate,decoration={text along path,
text={In Paris there is a tower and beneath it there grows a flower. And often
on Mondays there is a shower.}}] mypath;
end{tikzpicture}
end{document}
The IMHO most stunning tools are however not from the pgfmanual, but due to Paul Gaborit's great answer. You basically define the contour and the macro takes care of the rest. (Of course, you may want to tune things in the end a bit, but it is stunning how much it does out of the box.)
documentclass{standalone}
usepackage{lmodern}
usepackage[T1]{fontenc}
usepackage{shapepar}
usepackage{microtype}
usepackage{lipsum}
usepackage{tikz}
usetikzlibrary{calc,fit,intersections}
defshapeparnodeaccuracy{2}
newcommandshapeparnode[6]{
% 6 parameters:
% style for node (default:empty),
% h margin, v margin, left path, right path, text (just one paragraph!)
% name left and right paths and compute there bounding boxes
begin{scope}[local bounding box=leftbb]
path[name path global=left,xshift=#2] #4;
end{scope}
node[inner ysep=-#3,inner xsep=0pt,fit=(leftbb)](leftbb){};
begin{scope}[local bounding box=rightbb]
path[name path global=right,xshift=-#2] #5;
end{scope}
node[inner ysep=-#3,inner xsep=0pt,fit=(rightbb)](rightbb){};
% global bounding box
path let
p1=(leftbb.north west), p2=(leftbb.south west),
p3=(rightbb.north east), p4=(rightbb.south east)
in
pgfextra{
pgfmathsetmacro{ymin}{(y1 < y3) ? y1 : y3}
pgfmathsetmacro{ymax}{(y2 > y4) ? y2 : y4}
typeout{ymin ymin}
typeout{ymax ymax}
} node[inner sep=0,fit={(x1,ymin pt)(x3,ymax pt)}](mybb){};
% compute nb steps
path let p1=(mybb.north), p2=(mybb.south) in
pgfextra{
pgfmathsetmacro{fnthght}{1em/shapeparnodeaccuracy}
pgfmathtruncatemacro{nbsteps}{(y1-y2)/fnthght}
xdefnbsteps{nbsteps}
typeout{nb steps nbsteps}
};
% horizontal references
path (mybb.north) -- (mybb.south)
foreach cnt in {0,1,...,nbsteps}{
pgfextra{pgfmathsetmacro{pos}{cnt/nbsteps}}
coordinate[pos=pos] (ref cnt)
};
% left and right boundaries coordinates
foreach cnt in {0,1,...,nbsteps}{
% an horizontal line from left to right
path[name path=ltor]
(mybb.west |- ref cnt) -- (mybb.east |- ref cnt);
% same line from right to left
path[name path=rtol]
(mybb.east |- ref cnt) -- (mybb.west |- ref cnt);
% left boundary
path[name intersections={of=rtol and left,by={l cnt},sort by=rtol}];
% right boundary
path[name intersections={of=ltor and right,by={r cnt},sort by=ltor}];
}
% start point (and initial value of boundshape)
path let p1=(l 0) in
pgfextra{
pgfmathsetmacro{xstart}{x1}
xdefboundshape{{0}{0}b{xstart}}
xdefxmin{xstart}
xdefxmax{xstart}
};
% top and bottom
path let p1=(l 0), p2=(l nbsteps) in
pgfextra{
pgfmathsetmacro{ystart}{y1}xdefystart{ystart}
pgfmathsetmacro{yending}{y2}xdefyending{yending}
};
% incremental definition of boundshape
foreach cnt in {0,1,...,nbsteps}{
path let p1=(l cnt), p2=(r cnt) in
pgfextra{
pgfmathsetmacro{start}{x1}
pgfmathsetmacro{len}{x2-x1}
pgfmathsetmacro{ypos}{cnt/nbsteps*(ystart - yending)}
{let\=relax xdefboundshape{boundshape\{ypos}t{start}{len}}}
pgfmathsetmacro{xmin}{(xmin < start) ? xmin : start}
xdefxmin{xmin}
pgfmathsetmacro{xmax}{(xmax > start + len) ? xmax : start + len}
xdefxmax{xmax}
};
}
% draw the node with text in a shapepar
pgfmathsetmacro{ymax}{ystart - yending}
{let\=relax xdefboundshape{boundshape\{ymax}e{0}}}
node[#1,text width=xmax pt - xmin pt,align=flush left,
anchor=north west,inner sep=0]
at (mybb.north west -| xmin pt,0)
{Shapepar[1pt]{boundshape}#6par};
}
defmytext{In Paris there is a tower and beneath it there grows a flower.}
begin{document}%
begin{tikzpicture}
defpathone{(0,1) -- (-0.8,1) -- (-1.5,0) --
(-2,0) to[bend right=10] (0,5.1)}
defpathtwo{(0,5.1)
to[bend right=10] (2,0) -- (1.5,0) -- (0.8,1) -- (-0.8,1)}
fill[top color=lime,bottom color=orange,middle color=yellow,draw=white]
pathone -- pathtwo -- cycle;
defpathone{(0,1) -- (-0.8,1) -- (-1.5,0) --
(-1.6,0) to[bend right=10] (0,4.1)}
defpathtwo{(0,4.1)
to[bend right=10] (1.6,0) -- (1.5,0) -- (0.8,1) -- (-0.8,1)}
shapeparnode[text=black,font=footnotesizescshape]
{0.1em}{0.1em}{pathone}{pathtwo}{mytext}%
%draw[orange] pathone;
%draw[orange] pathtwo;
end{tikzpicture}
end{document}
add a comment |
This is just to mention that TikZ has already built in a large selection of tricks that can be applied to paths. Here is a very basic example. (Yes, I know I am not a poet.;-)
documentclass[tikz,border=3.14mm]{standalone}
usetikzlibrary{decorations.text}
begin{document}
begin{tikzpicture}
defmypath{
(-2,0) to[bend right=10] (0,5.1)
to[bend right=10] (2,0) -- (1.5,0) -- (0.8,1) -- (-0.8,1) -- (-1.5,0) -- cycle}
draw mypath;
path[decorate,decoration={text along path,
text={In Paris there is a tower and beneath it there grows a flower. And often
on Mondays there is a shower.}}] mypath;
end{tikzpicture}
end{document}
The IMHO most stunning tools are however not from the pgfmanual, but due to Paul Gaborit's great answer. You basically define the contour and the macro takes care of the rest. (Of course, you may want to tune things in the end a bit, but it is stunning how much it does out of the box.)
documentclass{standalone}
usepackage{lmodern}
usepackage[T1]{fontenc}
usepackage{shapepar}
usepackage{microtype}
usepackage{lipsum}
usepackage{tikz}
usetikzlibrary{calc,fit,intersections}
defshapeparnodeaccuracy{2}
newcommandshapeparnode[6]{
% 6 parameters:
% style for node (default:empty),
% h margin, v margin, left path, right path, text (just one paragraph!)
% name left and right paths and compute there bounding boxes
begin{scope}[local bounding box=leftbb]
path[name path global=left,xshift=#2] #4;
end{scope}
node[inner ysep=-#3,inner xsep=0pt,fit=(leftbb)](leftbb){};
begin{scope}[local bounding box=rightbb]
path[name path global=right,xshift=-#2] #5;
end{scope}
node[inner ysep=-#3,inner xsep=0pt,fit=(rightbb)](rightbb){};
% global bounding box
path let
p1=(leftbb.north west), p2=(leftbb.south west),
p3=(rightbb.north east), p4=(rightbb.south east)
in
pgfextra{
pgfmathsetmacro{ymin}{(y1 < y3) ? y1 : y3}
pgfmathsetmacro{ymax}{(y2 > y4) ? y2 : y4}
typeout{ymin ymin}
typeout{ymax ymax}
} node[inner sep=0,fit={(x1,ymin pt)(x3,ymax pt)}](mybb){};
% compute nb steps
path let p1=(mybb.north), p2=(mybb.south) in
pgfextra{
pgfmathsetmacro{fnthght}{1em/shapeparnodeaccuracy}
pgfmathtruncatemacro{nbsteps}{(y1-y2)/fnthght}
xdefnbsteps{nbsteps}
typeout{nb steps nbsteps}
};
% horizontal references
path (mybb.north) -- (mybb.south)
foreach cnt in {0,1,...,nbsteps}{
pgfextra{pgfmathsetmacro{pos}{cnt/nbsteps}}
coordinate[pos=pos] (ref cnt)
};
% left and right boundaries coordinates
foreach cnt in {0,1,...,nbsteps}{
% an horizontal line from left to right
path[name path=ltor]
(mybb.west |- ref cnt) -- (mybb.east |- ref cnt);
% same line from right to left
path[name path=rtol]
(mybb.east |- ref cnt) -- (mybb.west |- ref cnt);
% left boundary
path[name intersections={of=rtol and left,by={l cnt},sort by=rtol}];
% right boundary
path[name intersections={of=ltor and right,by={r cnt},sort by=ltor}];
}
% start point (and initial value of boundshape)
path let p1=(l 0) in
pgfextra{
pgfmathsetmacro{xstart}{x1}
xdefboundshape{{0}{0}b{xstart}}
xdefxmin{xstart}
xdefxmax{xstart}
};
% top and bottom
path let p1=(l 0), p2=(l nbsteps) in
pgfextra{
pgfmathsetmacro{ystart}{y1}xdefystart{ystart}
pgfmathsetmacro{yending}{y2}xdefyending{yending}
};
% incremental definition of boundshape
foreach cnt in {0,1,...,nbsteps}{
path let p1=(l cnt), p2=(r cnt) in
pgfextra{
pgfmathsetmacro{start}{x1}
pgfmathsetmacro{len}{x2-x1}
pgfmathsetmacro{ypos}{cnt/nbsteps*(ystart - yending)}
{let\=relax xdefboundshape{boundshape\{ypos}t{start}{len}}}
pgfmathsetmacro{xmin}{(xmin < start) ? xmin : start}
xdefxmin{xmin}
pgfmathsetmacro{xmax}{(xmax > start + len) ? xmax : start + len}
xdefxmax{xmax}
};
}
% draw the node with text in a shapepar
pgfmathsetmacro{ymax}{ystart - yending}
{let\=relax xdefboundshape{boundshape\{ymax}e{0}}}
node[#1,text width=xmax pt - xmin pt,align=flush left,
anchor=north west,inner sep=0]
at (mybb.north west -| xmin pt,0)
{Shapepar[1pt]{boundshape}#6par};
}
defmytext{In Paris there is a tower and beneath it there grows a flower.}
begin{document}%
begin{tikzpicture}
defpathone{(0,1) -- (-0.8,1) -- (-1.5,0) --
(-2,0) to[bend right=10] (0,5.1)}
defpathtwo{(0,5.1)
to[bend right=10] (2,0) -- (1.5,0) -- (0.8,1) -- (-0.8,1)}
fill[top color=lime,bottom color=orange,middle color=yellow,draw=white]
pathone -- pathtwo -- cycle;
defpathone{(0,1) -- (-0.8,1) -- (-1.5,0) --
(-1.6,0) to[bend right=10] (0,4.1)}
defpathtwo{(0,4.1)
to[bend right=10] (1.6,0) -- (1.5,0) -- (0.8,1) -- (-0.8,1)}
shapeparnode[text=black,font=footnotesizescshape]
{0.1em}{0.1em}{pathone}{pathtwo}{mytext}%
%draw[orange] pathone;
%draw[orange] pathtwo;
end{tikzpicture}
end{document}
add a comment |
This is just to mention that TikZ has already built in a large selection of tricks that can be applied to paths. Here is a very basic example. (Yes, I know I am not a poet.;-)
documentclass[tikz,border=3.14mm]{standalone}
usetikzlibrary{decorations.text}
begin{document}
begin{tikzpicture}
defmypath{
(-2,0) to[bend right=10] (0,5.1)
to[bend right=10] (2,0) -- (1.5,0) -- (0.8,1) -- (-0.8,1) -- (-1.5,0) -- cycle}
draw mypath;
path[decorate,decoration={text along path,
text={In Paris there is a tower and beneath it there grows a flower. And often
on Mondays there is a shower.}}] mypath;
end{tikzpicture}
end{document}
The IMHO most stunning tools are however not from the pgfmanual, but due to Paul Gaborit's great answer. You basically define the contour and the macro takes care of the rest. (Of course, you may want to tune things in the end a bit, but it is stunning how much it does out of the box.)
documentclass{standalone}
usepackage{lmodern}
usepackage[T1]{fontenc}
usepackage{shapepar}
usepackage{microtype}
usepackage{lipsum}
usepackage{tikz}
usetikzlibrary{calc,fit,intersections}
defshapeparnodeaccuracy{2}
newcommandshapeparnode[6]{
% 6 parameters:
% style for node (default:empty),
% h margin, v margin, left path, right path, text (just one paragraph!)
% name left and right paths and compute there bounding boxes
begin{scope}[local bounding box=leftbb]
path[name path global=left,xshift=#2] #4;
end{scope}
node[inner ysep=-#3,inner xsep=0pt,fit=(leftbb)](leftbb){};
begin{scope}[local bounding box=rightbb]
path[name path global=right,xshift=-#2] #5;
end{scope}
node[inner ysep=-#3,inner xsep=0pt,fit=(rightbb)](rightbb){};
% global bounding box
path let
p1=(leftbb.north west), p2=(leftbb.south west),
p3=(rightbb.north east), p4=(rightbb.south east)
in
pgfextra{
pgfmathsetmacro{ymin}{(y1 < y3) ? y1 : y3}
pgfmathsetmacro{ymax}{(y2 > y4) ? y2 : y4}
typeout{ymin ymin}
typeout{ymax ymax}
} node[inner sep=0,fit={(x1,ymin pt)(x3,ymax pt)}](mybb){};
% compute nb steps
path let p1=(mybb.north), p2=(mybb.south) in
pgfextra{
pgfmathsetmacro{fnthght}{1em/shapeparnodeaccuracy}
pgfmathtruncatemacro{nbsteps}{(y1-y2)/fnthght}
xdefnbsteps{nbsteps}
typeout{nb steps nbsteps}
};
% horizontal references
path (mybb.north) -- (mybb.south)
foreach cnt in {0,1,...,nbsteps}{
pgfextra{pgfmathsetmacro{pos}{cnt/nbsteps}}
coordinate[pos=pos] (ref cnt)
};
% left and right boundaries coordinates
foreach cnt in {0,1,...,nbsteps}{
% an horizontal line from left to right
path[name path=ltor]
(mybb.west |- ref cnt) -- (mybb.east |- ref cnt);
% same line from right to left
path[name path=rtol]
(mybb.east |- ref cnt) -- (mybb.west |- ref cnt);
% left boundary
path[name intersections={of=rtol and left,by={l cnt},sort by=rtol}];
% right boundary
path[name intersections={of=ltor and right,by={r cnt},sort by=ltor}];
}
% start point (and initial value of boundshape)
path let p1=(l 0) in
pgfextra{
pgfmathsetmacro{xstart}{x1}
xdefboundshape{{0}{0}b{xstart}}
xdefxmin{xstart}
xdefxmax{xstart}
};
% top and bottom
path let p1=(l 0), p2=(l nbsteps) in
pgfextra{
pgfmathsetmacro{ystart}{y1}xdefystart{ystart}
pgfmathsetmacro{yending}{y2}xdefyending{yending}
};
% incremental definition of boundshape
foreach cnt in {0,1,...,nbsteps}{
path let p1=(l cnt), p2=(r cnt) in
pgfextra{
pgfmathsetmacro{start}{x1}
pgfmathsetmacro{len}{x2-x1}
pgfmathsetmacro{ypos}{cnt/nbsteps*(ystart - yending)}
{let\=relax xdefboundshape{boundshape\{ypos}t{start}{len}}}
pgfmathsetmacro{xmin}{(xmin < start) ? xmin : start}
xdefxmin{xmin}
pgfmathsetmacro{xmax}{(xmax > start + len) ? xmax : start + len}
xdefxmax{xmax}
};
}
% draw the node with text in a shapepar
pgfmathsetmacro{ymax}{ystart - yending}
{let\=relax xdefboundshape{boundshape\{ymax}e{0}}}
node[#1,text width=xmax pt - xmin pt,align=flush left,
anchor=north west,inner sep=0]
at (mybb.north west -| xmin pt,0)
{Shapepar[1pt]{boundshape}#6par};
}
defmytext{In Paris there is a tower and beneath it there grows a flower.}
begin{document}%
begin{tikzpicture}
defpathone{(0,1) -- (-0.8,1) -- (-1.5,0) --
(-2,0) to[bend right=10] (0,5.1)}
defpathtwo{(0,5.1)
to[bend right=10] (2,0) -- (1.5,0) -- (0.8,1) -- (-0.8,1)}
fill[top color=lime,bottom color=orange,middle color=yellow,draw=white]
pathone -- pathtwo -- cycle;
defpathone{(0,1) -- (-0.8,1) -- (-1.5,0) --
(-1.6,0) to[bend right=10] (0,4.1)}
defpathtwo{(0,4.1)
to[bend right=10] (1.6,0) -- (1.5,0) -- (0.8,1) -- (-0.8,1)}
shapeparnode[text=black,font=footnotesizescshape]
{0.1em}{0.1em}{pathone}{pathtwo}{mytext}%
%draw[orange] pathone;
%draw[orange] pathtwo;
end{tikzpicture}
end{document}
This is just to mention that TikZ has already built in a large selection of tricks that can be applied to paths. Here is a very basic example. (Yes, I know I am not a poet.;-)
documentclass[tikz,border=3.14mm]{standalone}
usetikzlibrary{decorations.text}
begin{document}
begin{tikzpicture}
defmypath{
(-2,0) to[bend right=10] (0,5.1)
to[bend right=10] (2,0) -- (1.5,0) -- (0.8,1) -- (-0.8,1) -- (-1.5,0) -- cycle}
draw mypath;
path[decorate,decoration={text along path,
text={In Paris there is a tower and beneath it there grows a flower. And often
on Mondays there is a shower.}}] mypath;
end{tikzpicture}
end{document}
The IMHO most stunning tools are however not from the pgfmanual, but due to Paul Gaborit's great answer. You basically define the contour and the macro takes care of the rest. (Of course, you may want to tune things in the end a bit, but it is stunning how much it does out of the box.)
documentclass{standalone}
usepackage{lmodern}
usepackage[T1]{fontenc}
usepackage{shapepar}
usepackage{microtype}
usepackage{lipsum}
usepackage{tikz}
usetikzlibrary{calc,fit,intersections}
defshapeparnodeaccuracy{2}
newcommandshapeparnode[6]{
% 6 parameters:
% style for node (default:empty),
% h margin, v margin, left path, right path, text (just one paragraph!)
% name left and right paths and compute there bounding boxes
begin{scope}[local bounding box=leftbb]
path[name path global=left,xshift=#2] #4;
end{scope}
node[inner ysep=-#3,inner xsep=0pt,fit=(leftbb)](leftbb){};
begin{scope}[local bounding box=rightbb]
path[name path global=right,xshift=-#2] #5;
end{scope}
node[inner ysep=-#3,inner xsep=0pt,fit=(rightbb)](rightbb){};
% global bounding box
path let
p1=(leftbb.north west), p2=(leftbb.south west),
p3=(rightbb.north east), p4=(rightbb.south east)
in
pgfextra{
pgfmathsetmacro{ymin}{(y1 < y3) ? y1 : y3}
pgfmathsetmacro{ymax}{(y2 > y4) ? y2 : y4}
typeout{ymin ymin}
typeout{ymax ymax}
} node[inner sep=0,fit={(x1,ymin pt)(x3,ymax pt)}](mybb){};
% compute nb steps
path let p1=(mybb.north), p2=(mybb.south) in
pgfextra{
pgfmathsetmacro{fnthght}{1em/shapeparnodeaccuracy}
pgfmathtruncatemacro{nbsteps}{(y1-y2)/fnthght}
xdefnbsteps{nbsteps}
typeout{nb steps nbsteps}
};
% horizontal references
path (mybb.north) -- (mybb.south)
foreach cnt in {0,1,...,nbsteps}{
pgfextra{pgfmathsetmacro{pos}{cnt/nbsteps}}
coordinate[pos=pos] (ref cnt)
};
% left and right boundaries coordinates
foreach cnt in {0,1,...,nbsteps}{
% an horizontal line from left to right
path[name path=ltor]
(mybb.west |- ref cnt) -- (mybb.east |- ref cnt);
% same line from right to left
path[name path=rtol]
(mybb.east |- ref cnt) -- (mybb.west |- ref cnt);
% left boundary
path[name intersections={of=rtol and left,by={l cnt},sort by=rtol}];
% right boundary
path[name intersections={of=ltor and right,by={r cnt},sort by=ltor}];
}
% start point (and initial value of boundshape)
path let p1=(l 0) in
pgfextra{
pgfmathsetmacro{xstart}{x1}
xdefboundshape{{0}{0}b{xstart}}
xdefxmin{xstart}
xdefxmax{xstart}
};
% top and bottom
path let p1=(l 0), p2=(l nbsteps) in
pgfextra{
pgfmathsetmacro{ystart}{y1}xdefystart{ystart}
pgfmathsetmacro{yending}{y2}xdefyending{yending}
};
% incremental definition of boundshape
foreach cnt in {0,1,...,nbsteps}{
path let p1=(l cnt), p2=(r cnt) in
pgfextra{
pgfmathsetmacro{start}{x1}
pgfmathsetmacro{len}{x2-x1}
pgfmathsetmacro{ypos}{cnt/nbsteps*(ystart - yending)}
{let\=relax xdefboundshape{boundshape\{ypos}t{start}{len}}}
pgfmathsetmacro{xmin}{(xmin < start) ? xmin : start}
xdefxmin{xmin}
pgfmathsetmacro{xmax}{(xmax > start + len) ? xmax : start + len}
xdefxmax{xmax}
};
}
% draw the node with text in a shapepar
pgfmathsetmacro{ymax}{ystart - yending}
{let\=relax xdefboundshape{boundshape\{ymax}e{0}}}
node[#1,text width=xmax pt - xmin pt,align=flush left,
anchor=north west,inner sep=0]
at (mybb.north west -| xmin pt,0)
{Shapepar[1pt]{boundshape}#6par};
}
defmytext{In Paris there is a tower and beneath it there grows a flower.}
begin{document}%
begin{tikzpicture}
defpathone{(0,1) -- (-0.8,1) -- (-1.5,0) --
(-2,0) to[bend right=10] (0,5.1)}
defpathtwo{(0,5.1)
to[bend right=10] (2,0) -- (1.5,0) -- (0.8,1) -- (-0.8,1)}
fill[top color=lime,bottom color=orange,middle color=yellow,draw=white]
pathone -- pathtwo -- cycle;
defpathone{(0,1) -- (-0.8,1) -- (-1.5,0) --
(-1.6,0) to[bend right=10] (0,4.1)}
defpathtwo{(0,4.1)
to[bend right=10] (1.6,0) -- (1.5,0) -- (0.8,1) -- (-0.8,1)}
shapeparnode[text=black,font=footnotesizescshape]
{0.1em}{0.1em}{pathone}{pathtwo}{mytext}%
%draw[orange] pathone;
%draw[orange] pathtwo;
end{tikzpicture}
end{document}
answered 2 hours ago
marmotmarmot
113k5145274
113k5145274
add a comment |
add a comment |
Thanks for contributing an answer to TeX - LaTeX Stack Exchange!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2ftex.stackexchange.com%2fquestions%2f482345%2fpoetry-calligrams-and-tikz-pstricks-challenge%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
1
There’s one example of concrete poetry at tex.stackexchange.com/a/193563 I’m not persuaded that
tikz
is the best tool for this.– Thérèse
4 hours ago
1
A fine challenge! Personally, I'd like to try La colombe poignardée et le jet d'eau, but would prefer to do it with
pstricks
.– Bernard
4 hours ago
@Bernard oh this one is very pretty too !! I had it to my initial question
– Julien-Elie Taieb
4 hours ago
@Thérèse I am not sure I agree: tex.stackexchange.com/a/68740/121799.
– marmot
3 hours ago
See also: tex.stackexchange.com/a/403353/48
– ShreevatsaR
3 hours ago