TeX - LaTeX Asked by Challe on July 20, 2021
I’m trying to add a Venn diagram to my math homework. I figured out how to make the diagram but my problem is that the diagram is not under the itemize
item it should be.
Here’s my simplified LaTeX.
documentclass{article}
usepackage{tikz}
begin{document}
section{Task 1}
begin{itemize}
item[a)]
Here's the first solution.
item[b)]
begin{tikzpicture}
draw (0,0) ellipse (4cm and 2cm) node [left = 2cm] {Thing 1};
draw (1cm, 0) ellipse (2cm and 1cm) node {Thing 2};
end{tikzpicture}
end{itemize}
end{document}
And here’s the output of the LaTeX.
Why is the b)
under the diagram? How can I position the diagram so that the b)
is at the "start" of the diagram?
You need to set diagram baseline accordingly. In your case at top of image:
documentclass{article}
usepackage{tikz}
begin{document}
section{Task 1}
begin{itemize}
item[a)]
Here's the first solution.
item[b)]
begin{tikzpicture}[baseline=(current bounding box.north)] % <---
draw (0,0) ellipse (4cm and 2cm) node [left = 2cm] {Thing 1};
draw (1cm, 0) ellipse (2cm and 1cm) node {Thing 2};
end{tikzpicture}
end{itemize}
end{document}
Correct answer by Zarko on July 20, 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