Graphics, Figures & TablesHow to anchor a box to place text in it

Information and discussion about graphics, figures & tables in LaTeX documents.
Post Reply
Phooey
Posts: 5
Joined: Sun Sep 29, 2019 4:18 pm

How to anchor a box to place text in it

Post by Phooey »

Could someone kindly explain to me how the coordinates in this code works?

I am using this:

Code: Select all

\begin{tikzpicture}
	\draw (-3,0) rectangle (4,2) 
	 node at (0, 1.5){UWE registration number};
	\draw (4.25, 0) rectangle (7,2) 
	 node at (5.5, 1.5){Mark \%}; 
\end{tikzpicture}
This giving me two boxes side by side with the text in and is correctly placed.

I need another larger box directly underneath

Code: Select all

\begin{tikzpicture}
	\draw (-3,0) rectangle (7,12) 
	 node at (0, 1.5){lots ox text required in here};
\end{tikzpicture}
The box appears correctly until I try to place the text into it. Then the box moves all over the place. It is a lot of text and with every line I get a complete movement of the box.

If I could understand how to anchor the box while placing the text I think it would help.

Cheers

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

And: Currently, Packt sells ebooks for $4.99 each if you buy 5 of their over 1000 ebooks. If you choose only a single one, $9.99. How about combining 3 LaTeX books with Python, gnuplot, mathplotlib, Matlab, ChatGPT or other AI books? Epub and PDF. Bundle (3 books, add more for higher discount): https://packt.link/MDH5p

Phooey
Posts: 5
Joined: Sun Sep 29, 2019 4:18 pm

How to anchor a box to place text in it

Post by Phooey »

I've just discovered \fbox{}

That might solve the immediate problem.
Post Reply