5

I'm using this code to draw curly brackets

\documentclass[]{scrartcl}
\usepackage{tikz}
\usetikzlibrary{fit,calc,positioning,decorations.pathreplacing,matrix}
\begin{document}   
\begin{tikzpicture}[decoration={brace}][scale=2] 
   \node [draw] (A) {A}; 
   \node [fit=(A)] (fit) {};              
  \draw [decorate,line width=1pt] (fit.south west) -- (fit.north west);
\end{tikzpicture}

\end{document} 

How can I make this brace span the entire height of the "A" character ?

2 Answers 2

11

You can apply a convenient shift to the coordinates used for the brace:

\documentclass[]{scrartcl}
\usepackage{tikz}
\usetikzlibrary{fit,calc,positioning,decorations.pathreplacing,matrix}

\begin{document}   

\begin{tikzpicture}[decoration={brace}][scale=2] 
\node [draw] (A) {A}; 
\node [fit=(A)] (fit) {};              
\draw [decorate,line width=1pt] 
  ([yshift=-5pt]fit.south west) -- ([yshift=5pt]fit.north west);
\end{tikzpicture}

\end{document} 

enter image description here

Your settings for scale=2 won't have any effect since you are using a second optional argument which is not a correct syntax; tikzpicture only admits one optional argument:

\begin{tikzpicture}[<options>]
...
\end{tikzpicture}

where <options> is a comma separated list of options.

It is not clear to me why are you using the fit node; you can use something like this, without this node:

\documentclass[]{scrartcl}
\usepackage{tikz}
\usetikzlibrary{fit,calc,positioning,decorations.pathreplacing,matrix}

\begin{document}   

\begin{tikzpicture}
\node [draw] (A) {A}; 
\draw[decoration={brace,raise=5pt},decorate,line width=1pt] 
  ([yshift=-5pt]A.south west) -- ([yshift=5pt]A.north west);
\end{tikzpicture}

\end{document} 

Also, notice that the option scale=2 is not having effect (you would need to add transform shape).

7

With simple LaTeX code:

\documentclass{scrartcl}
\begin{document}   

$ \left\{ \rule{0pt}{5mm}\fbox{A} \right. $
$ \left\{ \rule{0pt}{15mm}\fbox{A} \right. $
$ \left\{ \rule{0pt}{20mm}\fbox{A} \right. $

\end{document} 

enter image description here

You must log in to answer this question.

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