I know how to draw a curly bracket with the following code:

\draw[decorate,decoration={brace,amplitude=5},-] (0.8,-0.75) -- (0.8,0.75);

But now I want to draw a round bracket, or a rectangular one. Can anyone tell how can I do this? Is it possible to do this by changing "brace" to some other values?

The result should look like: (some pictures)

but not {some pictures}

  • 1
    It would be helpful if you composed a fully compilable MWE including \documentclass and the appropriate packages that sets up the problem. While solving problems can be fun, setting them up is not. Then, those trying to help can simply cut and paste your MWE and get started on solving the problem. – Peter Grill Sep 30 '14 at 5:01

Below I define the styles

  • square left brace,
  • square right brace,
  • round left paren, and
  • round right paren

which yield:

enter image description here




%% https://tex.stackexchange.com/questions/55068/is-there-a-tikz-equivalent-to-the-pstricks-ncbar-command
    ncbar angle/.initial=90,
        to path=(\tikztostart)
        -- ($(\tikztostart)!#1!\pgfkeysvalueof{/tikz/ncbar angle}:(\tikztotarget)$)
        -- ($(\tikztotarget)!($(\tikztostart)!#1!\pgfkeysvalueof{/tikz/ncbar angle}:(\tikztotarget)$)!\pgfkeysvalueof{/tikz/ncbar angle}:(\tikztostart)$)
        -- (\tikztotarget)

\tikzset{square left brace/.style={ncbar=0.5cm}}
\tikzset{square right brace/.style={ncbar=-0.5cm}}

\tikzset{round left paren/.style={ncbar=0.5cm,out=120,in=-120}}
\tikzset{round right paren/.style={ncbar=0.5cm,out=60,in=-60}}


    \draw [red, thick] (0,0) to [square left brace ] (0,4);
    \draw [red, thick] (1,0) to [square right brace] (1,4);

    \draw [blue, thick] (3,0) to [round left paren ] (3,4);
    \draw [blue, thick] (4,0) to [round right paren] (4,4);

There is no equivalent to brace for parentheses and square brackets that is defined in the TikZ library decorations.pathreplacing, unfortunately.

It depends on what your use case is as to whether the following recommendation is a sensible one or not, but one possible way you might achieve something like what you want is to make use of the \vphantom trick and the fact that ( and [ are delimiters.

Here, I put \left( and \right) in their own nodes that are placed relative to the main node using the TikZ library positioning.





    \node (picture) at (0,0) {\includegraphics[width=.5\textwidth]{image-a}};
    \node (left-paren) [left = of picture] {$\left(\vphantom{\includegraphics[width=.25\textwidth]{image-a}}\right.$};
    \node (right-paren) [right = of picture] {$\left.\vphantom{\includegraphics[width=.25\textwidth]{image-a}}\right)$};


enter image description here

  • 1
    If you don't want to wrap an image in parantheses you can use \rule{width}{height} instead of \includegraphics... to set the desired height. I think this should be the accepted answer, because the other answer produces ugly parantheses for bigger heights. – MaPePeR May 2 '16 at 11:18
  • I agree with @MaPePeR, great answer - please add their good suggestion as well. – kabanus Mar 31 at 10:14

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.