Update 2
Well, with Andrew Stacey's everybody's favorite TikZ library tikzmark
it is a little bit easier.
You need to download the file tikzmark.dtx
and run it through pdflatex
. If it requests and _example
file, ignore. You'll get two files tikzlibrarytikzmark.code.tex
and tikzlibrarytikzmarkextras.code.tex
. Place them in the directory of your working .tex
file or in your local texmf
tree. Load it with \usetikzlibrary{tikzmark}
.
I personally don't like the style of this brace, maybe I re-add my own style.
Instruction
Place \bracestart{<identifier>}
somewhere where you want the brace to start and \braceend{<identifier>}
where it should end. On every page the brace should appear, you have to add
\bracedraw[<brace>]{<identifier>}{<level>}{<node [] argument>}{<node text>}
where <brace>
will be used for the internally brace \draw
.
At the moment, the brace's nipple middle part will be at the half of the brace.
To do
- Automatically re-placement of the middle part and its text.
- Detection of left or right side placement (for
twoside
documents with different margins)
- Better interworking with
pgf
's key management (everything variable are TeX commands)
- …
Code
\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{calc,arrows,tikzmark,decorations.pathreplacing}
\tikzset{
next page=below,
mymarginbrace/.style={
decorate,
decoration={
brace,
amplitude=3em,
aspect=.5
},
thick,
rounded corners=10pt
}
}
\newcommand*{\tikzbracemargindistance}{12.5em} % probably should be some \marginwidth stuff and should handle even/odd pages (twoside)
\newcommand*{\tikzbraceleveldistance}{3em}
\newcommand*{\tikzbracestartheight}{1.5ex}
\newcommand*{\tikzbraceendheight}{\baselineskip-.5ex} % \tikzmark lands in the following par so we cheat ;)
\newcommand*{\tikzbracestartlength}{1.5em}
\newcommand{\bracestart}[1]{% #1 = name
\tikzmark{bracestart-#1}
}
\newcommand{\braceend}[1]{% #1 = name
\tikzmark{braceend-#1}
}
\newcommand{\bracedraw}[5][]{% #1 = optional argument for the brace line
% #2 = name
% #3 = level
% #4 = (mandatory) node argument
% #5 = node text
\tikz[overlay, remember picture] {
\draw[mymarginbrace, #1]
% (pic cs:braceend-#2) -- node[#4] {#5} (pic cs:bracestart-#2);
(perpendicular cs:
horizontal line through = {(pic cs:braceend-#2)},
vertical line through = {($(current page.west)+(\tikzbracemargindistance-#3*\tikzbraceleveldistance,0pt)$)})
-- node[sloped,above=2.5em, #4] {#5}
(perpendicular cs: horizontal line through = {($(pic cs:bracestart-#2)+(0,\tikzbracestartheight)$)}, vertical line through = {($(current page.west)+(\tikzbracemargindistance-#3*\tikzbraceleveldistance,0pt)$)})
;
}
}
\usepackage{lipsum}
\begin{document}
\lipsum[1-4]
\bracestart{a}
\bracedraw[]{a}{0}{}{Hallo! Text a} % start of a = draw
\lipsum*[5-6]
\braceend{a}
\bracedraw[]{a}{0}{}{Hallo! Text a} % end of a = draw
%
\lipsum[7-9]
\bracestart{b}
\bracedraw[]{b}{1}{}{Text b} % start of b = draw
\lipsum[10-11]
\bracestart{c}
\bracedraw[]{c}{0}{}{Text c} % start of c = draw
\bracedraw[]{b}{1}{}{Text b} % somewhere bet start and end of b but certainly on another page than start and end
%
\bracedraw[green]{d}{2}{}{Text d} % start and end only on one page ...
\bracestart{d}
\lipsum*[12]
\braceend{d}
\lipsum*[13-17]
\braceend{c}
\braceend{b}
\bracedraw[]{c}{0}{}{Text c} % end of c = draw
\bracedraw[]{b}{1}{}{Text b} % end of b = draw
\end{document}
Output
First draft
I have something of the following in mind [no MWE :(
and I haven't looked at your linked question].
Problem with braces will be to calculate the middle where that “nipple” part is.
Code
\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{calc,arrows}
\newcommand{\tikzmark}[3][]{\tikz[overlay,remember picture] \node[#1] (#2) at (#3) {};}
\usepackage{lipsum}
\begin{document}
\lipsum[1-4]
\tikzmark{up}{$(0,0)+(-2em,0)$}
\tikzmark{pageup}{$(current page.south west)+(4em,0em)$}
\tikz[overlay,remember picture] \draw[very thick] (up) to[out=180,in=95] node [sloped,midway,above] {Where do we go?} (pageup);
\lipsum[5-6]
\tikzmark{down}{$(0,0)+(-2em,0)$}
\tikzmark{pagedown}{$(current page.north west)+(4em,0em)$}
\tikz[overlay,remember picture] \draw[-latex,very thick] (pagedown) to[out=-85,in=180] node [above,sloped,pos=.8] {Whee!} (down);
\lipsum[7-9]
\end{document}
Output
![First attempt First attempt](https://i.stack.imgur.com/hoTfl.png)
Best Answer
You could use the parallel package.
To achieve the result you want, you can use:
Example: