Search code examples
latexvertical-alignment

How can I align vertically/on top tikz pictures (circuitikz) in minipage/figure/tabular environment?


I am trying to align vertically this 3 circuits. I would like to align the on top, instead of bottom part (they automatically align bottom with that code)

\documentclass{article}
\usepackage{graphicx} % Required for inserting images
\usepackage{tikz,circuitikz}
\usepackage[singlelinecheck=off]{caption}
\usepackage{float}


\begin{figure}[H]
\begin{minipage}{\textwidth}
 \renewcommand{\arraystretch}{1.0}
    \centering
    \Large
    \begin{tabular}{ccc}
    \scalebox{0.5}{
    \begin{circuitikz}[]
  \draw[]
  (0,3) to [R, l=$\mathbf{R_0}$,o-] (2,3) -- (2,4)
  to [C, l=$\mathbf{Q_{1}}$] (6,4) -- (6,3)
  to [short, -o] (7,3)
  (2,3) -- (2,2) to [R, l=$\mathbf{R_1}$] (6,2) -- (6,3); 
    \end{circuitikz}
    } & 
    \scalebox{0.5}{
     \begin{circuitikz}[]
  \draw[]
  (0,4) to [R, l=$R_0$,o-] (2,4) -- (2,5)
  to [C, l=$Q_{1}$] (8,5) -- (8,4)
  to [short, -o] (9,4)
  (2,4) -- (2,2) to [R, l=$R_1$] (4,2) -- (4,3)
  to [C, l=$Q_{2}$] (8,3)
  (4,2) -- (4,1) to [R, l=$R_2$] (8,1) -- (8,4); 
    \end{circuitikz}
    } & 
    \scalebox{0.5}{
    \begin{circuitikz}[]
  \draw[]
  (0,4) to [R, l=$R_0$,o-] (2,4) -- (2,5)
  to [C, l=$Q_{1}$] (9,5) -- (9,4)
  to [short, -o] (10,4)
  (2,4) -- (2,2) to [R, l=$R_1$] (4,2) -- (4,3)
  to [C, l=$Q_{2}$] (9,3)
  (4,2) -- (4,0) to [R, l=$R_2$] (6,0) -- (6,1)
  to [R, l=$R_3$] (9,1)
  (6,0) -- (6,-1) to [C, l=$Q_{3}$] (9,-1) -- (9,4); 
    \end{circuitikz}
    }\\ 
    \small(a) Randles & \small(b) 2 TC & \small(b) 3 TC
\end{tabular}
\end{minipage}
\vspace{-3pt}    
\captionsetup{labelfont=bf,labelsep=period,font=small}
    \caption{description}
    \label{fig:circuits}
\end{figure}

I would like the three circuits to be aligned on the top part. Also, if possible, to know how to align the at the same 'pole' height. Thank you.


Solution

  • You can use the baseline option from tikz to change the alignment. For example to get the images top aligned:

    \documentclass{article}
    \usepackage{graphicx} % Required for inserting images
    \usepackage{tikz,circuitikz}
    \usepackage[singlelinecheck=off]{caption}
    \usepackage{float}
    
    \usepackage{tabularray}
    \begin{document}
    
    \begin{figure}[H]
    \begin{minipage}{\textwidth}
     \renewcommand{\arraystretch}{1.0}
        \centering
        \Large
        \begin{tblr}{Q[c,t]Q[c,t]Q[c,t]}
        \scalebox{0.5}{
        \begin{circuitikz}[baseline=(current bounding box.north)]
      \draw[]
      (0,3) to [R, l=$\mathbf{R_0}$,o-] (2,3) -- (2,4)
      to [C, l=$\mathbf{Q_{1}}$] (6,4) -- (6,3)
      to [short, -o] (7,3)
      (2,3) -- (2,2) to [R, l=$\mathbf{R_1}$] (6,2) -- (6,3); 
        \end{circuitikz}
        } & 
        \scalebox{0.5}{
         \begin{circuitikz}[baseline=(current bounding box.north)]
      \draw[]
      (0,4) to [R, l=$R_0$,o-] (2,4) -- (2,5)
      to [C, l=$Q_{1}$] (8,5) -- (8,4)
      to [short, -o] (9,4)
      (2,4) -- (2,2) to [R, l=$R_1$] (4,2) -- (4,3)
      to [C, l=$Q_{2}$] (8,3)
      (4,2) -- (4,1) to [R, l=$R_2$] (8,1) -- (8,4); 
        \end{circuitikz}
        } & 
        \scalebox{0.5}{
        \begin{circuitikz}[baseline=(current bounding box.north)]
      \draw[]
      (0,4) to [R, l=$R_0$,o-] (2,4) -- (2,5)
      to [C, l=$Q_{1}$] (9,5) -- (9,4)
      to [short, -o] (10,4)
      (2,4) -- (2,2) to [R, l=$R_1$] (4,2) -- (4,3)
      to [C, l=$Q_{2}$] (9,3)
      (4,2) -- (4,0) to [R, l=$R_2$] (6,0) -- (6,1)
      to [R, l=$R_3$] (9,1)
      (6,0) -- (6,-1) to [C, l=$Q_{3}$] (9,-1) -- (9,4); 
        \end{circuitikz}
        }\\ 
        \small(a) Randles & \small(b) 2 TC & \small(b) 3 TC
    \end{tblr}
    \end{minipage}
    \vspace{-3pt}    
    \captionsetup{labelfont=bf,labelsep=period,font=small}
        \caption{description}
        \label{fig:circuits}
    \end{figure}
    \end{document}
    

    enter image description here