TeX - LaTeX Asked by Five9 on July 6, 2021
Will preface by saying I’m very unfamiliar with Tikz and I just edited a template.
The template was for a state diagram when I wanted to draw Markov chains.
Now, I want square nodes instead of circles because I’m doing something different; the text need causes the circle to be way too huge. I would rather have a rectangle.
I have:
documentclass[a4paper, 12pt, fleqn]{article}
usepackage{tikz}
usetikzlibrary{automata, positioning, shapes}
being{document}
begin{figure}[H]
centering
begin{tikzpicture}[node distance=6.5cm, auto]
node[state] (TL) {$102$ JPY/USD};
node[state, accepting] (BL) [below of=TL] {$(1+r_{USD})$ USD};
node[rectangle] (TR) [right of=TL] {$102$ JPY};
node[state] (BR) [below of=TR] {$(1+r_{JPY})$ JPY};
path[->]
(TL) edge node {$1 text{USD} times 102 text{JPY}$} (TR)
(TL) edge node {$r_{USD}$} (BL)
(TR) edge node {$r_{JPY}$} (BR)
(BR) edge [bend left] node {$1 text{USD} times 102 text{JPY}$} (BL)
;
end{tikzpicture}
caption{Covered Interest Rate Parity}
end{figure}
end{document}
But the TR node does not have an outline around it. I tried a bunch of different keywords I found around google, but only "node" seems to work. Is there no simple keyword option that can get me a rectangle?
Add "draw" to "rectangle" to the options of node:
...
node[rectangle, draw] (TR) [right of=TL] {$102$ JPY};
...
By default tikz does not draw the nodes.
Correct answer by Sergio Llorente on July 6, 2021
I would draw your image on the following way:
position
packagedocumentclass[a4paper, 12pt, fleqn]{article}
usepackage{tikz}
usetikzlibrary{arrows.meta, automata,
positioning,
quotes}
usepackage{amsmath}
usepackage[low-sup]{subdepth}
begin{document}
begin{figure}[ht]
centering
begin{tikzpicture}[
node distance = 44mm and 66mm, on grid,
state/.append style = {semithick, align=center, inner sep=1pt},
rct/.style = {draw},
every edge/.style = {draw, -Straight Barb, semithick},
every edge quote/.style = {auto, font=small}
]
node[state] (TL) {102 JPY/USD};
node[state, accepting] (BL) [below=of TL] {$(1+r_{text{USD}})$ USD};
node[rct] (TR) [right=of TL] {102 JPY};
node[state] (BR) [below=of TR] {$(1+r_{text{JPY}})$ JPY};
%
path (TL) edge ["$1,text{USD} times 102,text{JPY}$"] (TR)
(TL) edge ["$r_{text{USD}}$"] (BL)
(TR) edge ["$r_{text{JPY}}$"] (BR)
(BR) edge [bend left, "$1,text{USD} times 102,text{JPY}$"] (BL)
;
end{tikzpicture}
caption{Covered Interest Rate Parity}
end{figure}
end{document}
Note: In node style is usually defined:
inner sep
, outer sep
)Answered by Zarko on July 6, 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