1

I did the following drawing on Tikz:

enter image description here

Its MWE is:

\begin{tikzpicture}
\node[text width=2.65cm,text centered] (R) at (-3,0) {Radical ideals of $A$};
\node[text width=2.8cm, text centered] (C) at (3,0) {Closed subsets of $\operatorname{Spec} A$};
\draw[->,transform canvas={yshift=0.15cm}] (R) -- (C) node[midway,above]{$V(\cdot)$};
\draw[<-,transform canvas={yshift=-0.15cm}] (R) -- (C) node[midway,below]{$I(\cdot)$};
\end{tikzpicture}

It looks great but I would like to have curly braces around the nodes as if they were sets (in the mathematical sense) and I would like for the arrows to be a little bigger (just like the function arrows $\to$).

How could I do it?

Gabriel
  • 867
  • \node {\{ text \}};? For bigger braces you can use a decoration, e.g. https://tex.stackexchange.com/questions/20885/ By "bigger", do you mean just the arrow tips? With the tips from the arrows.meta library you can set the size, see e.g. https://tex.stackexchange.com/a/161238/ – Torbjørn T. Sep 24 '20 at 15:24
  • Since my nodes have two lines of text, when I use your first idea I obtain the left brace on the first line and the right one on the second line, which is not what I want. I want the braces to span both lines. I also tried to use a decoration but failed to do what I described. I'll see the post about the arrows. – Gabriel Sep 24 '20 at 15:28
  • Just wanted to clarify what you were after (though in hindsight perhaps I should have understood what you wanted ..) Decorations can do it. By the way, it's always nicer if you make complete examples, particularly when using non-standard commands or packages/libraries. Granted, there doesn't seem to be anything relevant to the question about \Spec, but the general point stands. – Torbjørn T. Sep 24 '20 at 15:35
  • Sorry, I fixed the code. Could you say a little more about how I could use decorations to do it? I already tried and failed. – Gabriel Sep 24 '20 at 15:41

2 Answers2

1

I wrapped things in styles in the code below, but that is not required.

The reason there is so much air between node text and braces is the text width of the nodes, that can be modified in various ways, for example by using \node[align=center] (R) at (-3,0) {Radical\\ideals of $A$}; instead, then the node becomes only as wide as the longest line.

enter image description here

\documentclass[border=1cm]{standalone}
\usepackage{amsmath}
\usepackage{tikz}
\usetikzlibrary{decorations.pathreplacing, arrows.meta}
\begin{document}
\begin{tikzpicture}[
  Brace/.style={
     thick,
     decoration={ % define decoration
        brace,
        amplitude=5pt % height of curl
        },
     decorate % activate decoration
  },
  FuncArrow/.style={ % style for the lines
    -{To[length=3pt]}, % add arrow tip
    shorten >=8pt, shorten <=8pt % shorten the lines a bit so they don't crash with the braces
    }
]

\node[text width=2.65cm,text centered] (R) at (-3,0) {Radical ideals of $A$}; \node[text width=2.8cm, text centered] (C) at (3,0) {Closed subsets of $\operatorname{Spec} A$};

% modified the style here, and swapped the drawing coordinate order of the second one \draw[FuncArrow,transform canvas={yshift=0.15cm}] (R) -- (C) node[midway,above]{$V(\cdot)$}; \draw[FuncArrow,transform canvas={yshift=-0.15cm}] (C) -- (R) node[midway,below]{$I(\cdot)$};

\foreach \nodename in {R,C} { % draw braces for both nodes % the order of the coordinates matter, one is drawn from north to south, the other from south to north % (there is a mirror option for the brace decoration, but that would need two different decorations I think) \draw [Brace] (\nodename.north east) -- (\nodename.south east); \draw [Brace] (\nodename.south west) -- (\nodename.north west); } \end{tikzpicture} \end{document}

Torbjørn T.
  • 206,688
0

add to your preamble

\usetikzlibrary{decorations.pathreplacing}

and at the end of your code before endtikzpicture add

\draw [decorate,decoration={brace,amplitude=4pt,mirror,raise=4pt},xshift=10pt,line 
    width=2pt]
    (3.5,-0.65) -- (3.5,0.65);
    \draw [decorate,decoration={brace,amplitude=4pt,raise=4pt},xshift=10pt,line 
    width=2pt]
    (-4,-0.65) -- (-4,0.65);

enter image description here

js bibra
  • 21,280