LaTeX forum ⇒ Page LayoutAlignment in Minipages Topic is solved

Information and discussion about page layout specific issues (e.g. header and footer lines, page formats, page numbers).
ghuczek
Posts: 23
Joined: Sun Dec 23, 2012 8:09 pm

Alignment in Minipages

Postby ghuczek » Thu Jun 13, 2013 11:48 pm

I want the two circuit diagrams to align on the battery V_T, horizontally using minipage. I have the two circuits drawn as I want them using circuitikz. What do I need to do to correct the alignment?

  1. \documentclass[12pt,letterpaper,onecolumn]{article}
  2. %\usepackage[utf8]{inputenc}
  3. \usepackage{amsmath}
  4. %\usepackage{amsfonts}
  5. %\usepackage{amssymb}
  6. %\usepackage{graphicx}
  7. \usepackage{tikz}
  8. \usepackage{circuitikz}
  9.  
  10. %\usepackage{lmodern}
  11. \usepackage[left=2cm,right=2cm,top=2cm,bottom=2cm]{geometry}
  12.  
  13. \begin{document}
  14. %\hspace{.1cm}
  15. \vspace{4 cm}
  16. \begin{minipage}[t]{.8 in}
  17. %parallel circuit
  18. \begin{circuitikz}[scale=1.5]\draw
  19. (0,2) to [battery, l_= $V_T$, i<^ =$I_1$] (0,0)
  20. (0,0) -- (6,0)
  21. (6,2) -- (0,2)
  22. (4,2) to [R, l=$R$] (4,0)
  23. (6,2) to [R, l=$R$] (6,0)
  24. (2,2) to [R, l=$R$] (2,0);
  25. \end{circuitikz}
  26. \end{minipage}
  27. \hfill
  28. \begin{minipage}[t]{2.5 in}
  29. %series circuit
  30. \hspace{15 pt}
  31. %\vspace{.6 cm}
  32. %\hfill
  33. \begin{circuitikz}[scale=1.5] \draw
  34. (0,2) to [battery, l_= $V_{\text{T}}$,i<^=$I_2$] (0,0)
  35. (0,2) to [R,l=$R$] (2,2)
  36. (2,2) to [R,l=$R$] (2,0)
  37. (2,0) to [R,l=$R$] (0,0);
  38. \end{circuitikz}
  39. \end{minipage}\medskip
  40.  
  41. \end{document}

Tags:

User avatar
Johannes_B
Site Moderator
Posts: 4103
Joined: Thu Nov 01, 2012 4:08 pm

Postby Johannes_B » Fri Jun 14, 2013 8:51 am

Hi, you could use a bounding box to give the two different picture the same "starting point". Please consult the manual for more information.

  1. \documentclass[12pt,letterpaper,onecolumn]{article}
  2. \usepackage{tikz}
  3. \usepackage{amsmath}
  4. \usepackage{circuitikz}
  5.  
  6. \usepackage[left=2cm,right=2cm,top=2cm,bottom=2cm]{geometry}
  7.  
  8. \begin{document}
  9. \begin{minipage}[t]{0.55\linewidth}
  10. %parallel circuit
  11. \begin{circuitikz}[scale=1.4]
  12. \useasboundingbox (-1,-1.1) rectangle (6.1,3);
  13. \draw
  14. (0,2) to [battery, l_= $V_T$, i<^ =$I_1$] (0,0)
  15. (0,0) -- (6,0)
  16. (6,2) -- (0,2)
  17. (4,2) to [R, l=$R$] (4,0)
  18. (6,2) to [R, l=$R$] (6,0)
  19. (2,2) to [R, l=$R$] (2,0);
  20. \end{circuitikz}
  21. \end{minipage}
  22. \hfill
  23. \begin{minipage}[t]{0.35\linewidth}
  24. %series circuit
  25. \begin{circuitikz}[scale=1.4]
  26. \useasboundingbox (-1,-1.1) rectangle (2,3);
  27. \draw
  28. (0,2) to [battery, l_= $V_{\text{T}}$,i<^=$I_2$] (0,0)
  29. (0,2) to [R,l=$R$] (2,2)
  30. (2,2) to [R,l=$R$] (2,0)
  31. (2,0) to [R,l=$R$] (0,0);
  32. \end{circuitikz}
  33. \end{minipage}\medskip
  34.  
  35. \end{document}


I also changed the width of the minipages, and deleted all thos vskips. I think you are more flexible, if those width are a fraction of your linewidth.
The smart way: Calm down and take a deep breath, read posts and provided links attentively, try to understand and ask if necessary.

ghuczek
Posts: 23
Joined: Sun Dec 23, 2012 8:09 pm

Postby ghuczek » Fri Jun 14, 2013 4:20 pm

Thank you. That works very well. I'll study the differences in the code, especially the use of the \useasboundingbox idea to give the same starting point.


Return to “Page Layout”

Who is online

Users browsing this forum: No registered users and 2 guests