TeX - LaTeX Asked on April 27, 2021
I did the following drawing on Tikz:
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?
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) {Radicalideals of $A$};
instead, then the node becomes only as wide as the longest line.
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}
Correct answer by Torbjørn T. on April 27, 2021
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);
Answered by js bibra on April 27, 2021
Get help from others!
Recent Answers
Recent Questions
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP