Explanations
I try to put a text in shape to follow a figure’s edge to get someting like this:
(the red field is just given to explain)
Current situation
For the moment, this is my MWE
\documentclass[a5paper, twoside]{article}
% \usepackage[english]{babel}
% \usepackage{blindtext}
\usepackage{geometry}
\usepackage{lmodern}
\usepackage[T1]{fontenc}
\usepackage{shapepar}
\usepackage{microtype}
\usepackage{lipsum}
\usepackage{graphicx}
\usepackage{tikz}
\usetikzlibrary{calc,fit,intersections}
\geometry{a5paper}
\def\shapeparnodeaccuracy{2}
\newcommand\shapeparnode[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}
\nodeinner ysep=-#3,inner xsep=0pt,fit=(leftbb){};
\begin{scope}[local bounding box=rightbb]
\path[name path global=right,xshift=-#2] #5;
\end{scope}
\nodeinner ysep=-#3,inner xsep=0pt,fit=(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}
} nodeinner sep=0,fit={(\x1,\ymin pt)(\x3,\ymax pt)}{};
% compute nb steps
\path let \p1=(mybb.north), \p2=(mybb.south) in
\pgfextra{
\pgfmathsetmacro{\fnthght}{1em/\shapeparnodeaccuracy}
\pgfmathtruncatemacro{\nbsteps}{(\y1-\y2)/\fnthght}
\xdef\nbsteps{\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}
\xdef\boundshape{{0}{0}b{\xstart}}
\xdef\xmin{\xstart}
\xdef\xmax{\xstart}
};
% top and bottom
\path let \p1=(l 0), \p2=(l \nbsteps) in
\pgfextra{
\pgfmathsetmacro{\ystart}{\y1}\xdef\ystart{\ystart}
\pgfmathsetmacro{\yending}{\y2}\xdef\yending{\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 \xdef\boundshape{\boundshape\{\ypos}t{\start}{\len}}}
\pgfmathsetmacro{\xmin}{(\xmin < \start) ? \xmin : \start}
\xdef\xmin{\xmin}
\pgfmathsetmacro{\xmax}{(\xmax > \start + \len) ? \xmax : \start + \len}
\xdef\xmax{\xmax}
};
}
% draw the node with text in a shapepar
\pgfmathsetmacro{\ymax}{\ystart - \yending}
{\let\=\relax \xdef\boundshape{\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}#6\par};
}
\begin{document}
\thispagestyle{empty}
\newgeometry{top=1cm, bottom=1cm, inner=1.4cm, outer=0.3cm}
\noindent%
\rlap{
\begin{tikzpicture}[remember picture, overlay]
\node [shift={(4.5cm, -10.5cm)}] at (current page.north west)
{\hspace{3cm} \includegraphics{nil.pdf} };
\end{tikzpicture}
}
\begin{tikzpicture}
\def\pathone{(0,0) to (0,-20)}
\def\pathtwo{(4,-4) to [out=up, in=down] (6.5,0)}
\def\pathtwo{(4,0) -- (-.5,-7) -- (2,-5.2) to[bend right] (3,-10)}%
\shapeparnode{1em}{.2em}{\pathone}{\pathtwo}{%
Sed ut perspiciatis unde omnis iste natus error sit voluptatem accusantium doloremque laudantium, totam rem aperiam, eaque ipsa quae ab illo inventore veritatis et quasi architecto beatae vitae dicta sunt explicabo. Nemo enim ipsam voluptatem quia voluptas sit aspernatur aut odit aut fugit, sed quia consequuntur magni dolores eos qui ratione voluptatem sequi nesciunt. Neque porro quisquam est, qui dolorem ipsum quia dolor sit amet, consectetur, adipisci velit, sed quia non numquam eius modi tempora incidunt ut labore et dolore magnam aliquam quaerat voluptatem. Ut enim ad minima veniam, quis nostrum exercitationem ullam corporis suscipit laboriosam, nisi ut aliquid ex ea commodi consequatur? Quis autem vel eum iure reprehenderit qui in ea voluptate velit esse quam nihil molestiae consequatur, vel illum qui dolorem eum fugiat quo voluptas nulla pariatur?
}
\draw \pathone -- \pathtwo -- cycle;
\end{tikzpicture}
\restoregeometry
\end{document}
nil.pdf could be founded in http://taniere.info/tmp/nil.pdf
But the rendering… is not realy the expected one.
Some tries
Export to pstrick
With Inkscape, I tried to transform the shape’s right path into into a pspicture, and I get this:
%LaTeX with PSTricks extensions
%%Creator: inkscape 0.92.1
%%Please note this file requires PSTricks extensions
\psset{xunit=.5pt,yunit=.5pt,runit=.5pt}
\begin{pspicture}(197.64199565,498.89561931)
{
\newrgbcolor{curcolor}{0 0 0}
\pscustom[linewidth=0.99999995,linecolor=curcolor]
{
\newpath
\moveto(196.44835276,498.86665301)
\curveto(196.44835276,498.86665301)(194.45963339,464.59591915)(194.36749228,447.43989144)
\curveto(194.3137852,437.42771884)(194.66475213,419.19976419)(195.25929071,417.41616734)
\curveto(195.85381039,415.63257049)(198.79564346,387.00461459)(195.85381039,372.23199096)
\curveto(194.04201071,363.13383663)(190.35208063,354.13992167)(184.85502992,346.66722876)
\curveto(180.52437165,340.78012325)(171.14639244,339.09029648)(168.20821039,332.39852955)
\curveto(162.4683326,319.32586183)(163.32663307,302.37097679)(169.69453228,289.59243191)
\curveto(174.18788031,280.57561301)(189.93217134,280.10457049)(193.17844157,270.56753742)
\curveto(194.55695244,266.51766025)(193.87900346,260.27539254)(190.20579024,258.08239726)
\curveto(183.6018822,254.13974529)(175.57399181,263.36878466)(167.91096189,264.0277075)
\curveto(156.80989228,264.98226498)(144.75845291,265.67051695)(134.61732283,261.05507128)
\curveto(118.86245291,253.88470277)(108.67836094,238.00902403)(97.16201575,225.08602561)
\curveto(83.33079685,209.56550907)(74.18154331,190.07066813)(59.40941102,175.442876)
\curveto(50.45336693,166.57429018)(38.49879685,161.23578309)(29.08841575,152.85078781)
\curveto(20.34840945,145.06307128)(9.75821102,137.98605711)(5.01002835,127.28602561)
\curveto(-2.04593386,111.38543978)(1.47239055,92.64937679)(0.84831496,75.26472167)
\curveto(0.40750866,62.9853012)(0.52629921,50.67564451)(1.14576378,38.40393427)
\curveto(1.79262992,25.58268073)(4.71291969,0.05680986)(4.71291969,0.05680986)
}
}
\end{pspicture}
I don’t know if it could help in any way or if it is useless to tikzpicture.
Export to tikz
I also export to tikz and I get the following path, but I can’t find the way to make the shape follow this path.
\definecolor{cec0000}{RGB}{236,0,0}
\def \globalscale {1.000000}
\begin{tikzpicture}[y=0.80pt, x=0.80pt, yscale=-\globalscale, xscale=\globalscale, inner sep=0pt, outer sep=0pt]
\begin{scope}[cm={{1.33333,0.0,0.0,-1.33333,(-10.79605,521.90193)}}]
\path[draw=cec0000,line join=miter,line cap=butt,even odd rule,line
width=0.600pt] (8.4720,391.0515) -- (9.8097,16.9441) -- (232.0893,16.9441) ..
controls (232.0893,16.9441) and (230.5977,42.6471) .. (230.5286,55.5142) ..
controls (230.4883,63.0233) and (230.7516,76.6942) .. (231.1975,78.0319) ..
controls (231.6434,79.3696) and (233.8497,100.8406) .. (231.6434,111.9201) ..
controls (230.2845,118.7437) and (227.5171,125.4891) .. (223.3943,131.0936) ..
controls (220.1463,135.5090) and (213.1128,136.7764) .. (210.9092,141.7952) ..
controls (206.6043,151.5997) and (207.2480,164.3158) .. (212.0239,173.8997) ..
controls (215.3939,180.6624) and (227.2021,181.0156) .. (229.6368,188.1684) ..
controls (230.6707,191.2058) and (230.1623,195.8875) .. (227.4073,197.5323) ..
controls (222.4544,200.4893) and (216.4335,193.5675) .. (210.6862,193.0733) ..
controls (202.3604,192.3574) and (193.3218,191.8412) .. (185.7160,195.3028) ..
controls (173.8998,200.6806) and (166.2618,212.5873) .. (157.6245,222.2795) ..
controls (147.2511,233.9200) and (140.3892,248.5411) .. (129.3101,259.5119) ..
controls (122.5930,266.1633) and (113.6271,270.1672) .. (106.5693,276.4560) ..
controls (100.0143,282.2968) and (92.0717,287.6045) .. (88.5105,295.6295) ..
controls (83.2185,307.5550) and (85.8573,321.6070) .. (85.3892,334.6455) ..
controls (85.0586,343.8551) and (85.1478,353.0873) .. (85.6122,362.2911) ..
controls (86.0973,371.9071) and (88.2876,391.0515) .. (88.2876,391.0515) --
(8.4720,391.0515);
\end{scope}
\end{tikzpicture}
Conclusion
How to make the bottom-left box with the specific shape?


