TeX - LaTeX Asked by Jana on January 16, 2021
I’m drawing a diagram with nodes and I have to have the inner text of one node at the END of the line, i.e. at the right side, not left, not centered. Unfortunately I didn’t find a way nor information in the web.
That’s how my picture now looks like:
As you can see the text in the node “Client” (right side) is covered by the “Anwendungsprogramm”-node. How can I shove the text on the right side of the node?
The code:
(It’s a large document, that’s why I use this many packages. For I’m not sure which packages do influence my graphics, I’ll take all.)
usepackage[babel, german=quotes]{csquotes}
usepackage{array}
usepackage[style=alphabetic, backend=bibtex8]{biblatex}
usepackage{setspace}
usepackage{geometry}
usepackage[table]{xcolor}
usepackage[arrow, matrix, curve]{xy}
usepackage{calc}
usepackage{multirow}
usepackage{tikz}
usetikzlibrary{matrix,calc,positioning,arrows}
begin{document}
begin{figure}[htbp]
begin{center}
begin{tikzpicture}
node [rectangle, rounded corners=1mm, minimum size=25mm, text width=40mm,
anchor=base, very thick, draw=black!50, fill=black!10]
(server) {Server};
node [rectangle, rounded corners=1mm, minimum size=20mm, text width=25mm,
anchor=base, very thick, draw=black!50, text centered,
right=20mm of server]
(webservice) {Webservice};
node [rectangle, rounded corners=1mm, minimum size=20mm, text width=20mm,
anchor=base, very thick, draw=black!50, fill=white!100, text centered,
right=-25mm of server]
(server-p) {Anwen- dungs- programm};
node [rectangle, rounded corners=1mm, minimum size=25mm, text width=40mm,
anchor=base, very thick, draw=black!50, fill=black!10, text centered,
right=20mm of webservice]
(client) {Client};
node [rectangle, rounded corners=1mm, minimum size=20mm, text width=20mm,
anchor=base, very thick, draw=black!50, fill=white!100, text centered,
left=-25mm of client]
(client-p) {Anwen- dungs- programm};
draw [<->, very thick] (webservice) to (server-p);
draw [<->, very thick] (webservice) to (client-p);
end{tikzpicture}
bigskip
label{fig-funktionaleebenen}
end{center}
end{figure}
end{document}
If you delete text centered
as one of the node
options for client and then do as @GonzaloMedina suggested: add align=right
, this will right align the content of the node.
Here is a minimimal corrected code:
documentclass[12pt, a4paper]{scrartcl}
usepackage[babel, german=quotes]{csquotes}
usepackage[style=alphabetic, backend=bibtex8]{biblatex}
usepackage[table]{xcolor}
usepackage[arrow, matrix, curve]{xy}
usepackage{calc,multirow,tikz,array,setspace,geometry}
usetikzlibrary{matrix,calc,positioning,arrows}
begin{document}
begin{tikzpicture}
node [rectangle, rounded corners=1mm, minimum size=25mm, text width=40mm,
anchor=base, very thick, draw=black!50, fill=black!10]
(server) {Server};
node [rectangle, rounded corners=1mm, minimum size=20mm, text width=25mm,
anchor=base, very thick, draw=black!50, text centered,
right=20mm of server]
(webservice) {Webservice};
node [rectangle, rounded corners=1mm, minimum size=20mm, text width=20mm,
anchor=base, very thick, draw=black!50, fill=white!100, text centered,
right=-25mm of server]
(server-p) {Anwen- dungs- programm};
node [rectangle, rounded corners=1mm, minimum size=25mm, text width=40mm,
anchor=base, very thick, draw=black!50, fill=black!10, align = right,
right=20mm of webservice]
(client) {Client};
node [rectangle, rounded corners=1mm, minimum size=20mm, text width=20mm,
anchor=base, very thick, draw=black!50, fill=white!100, text centered,
left=-25mm of client]
(client-p) {Anwen- dungs- programm};
draw [<->, very thick] (webservice) to (server-p);
draw [<->, very thick] (webservice) to (client-p);
end{tikzpicture}
end{document}
Correct answer by Adam Liter on January 16, 2021
Get help from others!
Recent Questions
Recent Answers
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP