10

I wanted to put a brace from the excellent TikZ library calligraphy on one side of a minipage. I can't get it to work:

\documentclass{article}

\usepackage{xcolor}
\usepackage{tikz}
\usetikzlibrary{calc,decorations.pathreplacing,calligraphy}

\newcommand{\tikzmark}[1]{%
    \tikz[baseline={(#1.base)},remember picture]%
    \node[outer sep=0pt, inner sep=0pt] (#1) {\strut};}

\begin{document}

\begin{minipage}{0.5\textwidth}
\noindent\tikzmark{A}Lorem ipsum dolor sit amet, consectetur adipiscing elit. Morbi quis est quis arcu pretium imperdiet. Donec facilisis pharetra posuere. Proin auctor purus vel nunc ultrices, et mollis est ultrices. Nulla blandit finibus lacinia. Nam congue ante et libero ornare, et feugiat ipsum cursus. Quisque tincidunt a urna at vestibulum.\tikzmark{B}
\end{minipage}

\tikz[decorate,decoration={calligraphic brace,amplitude=6pt},remember picture,overlay,ultra thick]%
\draw ($(A.north) - (6pt,0)$) -- ($(A |- B.south) - (6pt,0)$);

\end{document}

This produces:

Example of failed braces with minipage.

No brace. What am I missing?

1 Answer 1

13

You need to say in \draw[decorate] ...; otherwise it draws an ordinary line ... So, try the following correction of your MWE:

\documentclass{article}

\usepackage{xcolor}
\usepackage{tikz}
\usetikzlibrary{calc,decorations.pathreplacing,calligraphy}

\newcommand{\tikzmark}[1]{%
    \tikz[baseline={(#1.base)},remember picture]%
    \node[outer sep=0pt, inner sep=0pt] (#1) {\strut};}

\begin{document}

\begin{minipage}{0.5\textwidth}
\noindent\tikzmark{A}Lorem ipsum dolor sit amet, consectetur adipiscing elit. Morbi quis est quis arcu pretium imperdiet. Donec facilisis pharetra posuere. Proin auctor purus vel nunc ultrices, et mollis est ultrices. Nulla blandit finibus lacinia. Nam congue ante et libero ornare, et feugiat ipsum cursus. Quisque tincidunt a urna at vestibulum.\tikzmark{B}
\end{minipage}

\tikz[remember picture,overlay,ultra thick,
      decoration={calligraphic brace, mirror,
                  raise=6pt, amplitude=6pt}]%
\draw[decorate] (A.north) -- (A |- B.south);

\end{document}

enter image description here

1
  • Thank you -- that's perfect. Also the raise=6pt is a nice touch.
    – sgmoye
    Commented Jun 20, 2016 at 19:31

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .