如何在minipage/figure/tabular环境中垂直/顶部对齐tikz图片(circuitikz)?

huangapple go评论125阅读模式
英文:

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.

答案1

得分: 0

你可以使用tikz中的baseline选项来更改对齐方式。例如,要使图像顶部对齐:

\documentclass{article}
\usepackage{graphicx} % 插入图像所需
\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(c) 3 TC
\end{tblr}
\end{minipage}
\vspace{-3pt}    
\captionsetup{labelfont=bf,labelsep=period,font=small}
    \caption{描述}
    \label{fig:circuits}
\end{figure}
\end{document}

如何在minipage/figure/tabular环境中垂直/顶部对齐tikz图片(circuitikz)?

英文:

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}

如何在minipage/figure/tabular环境中垂直/顶部对齐tikz图片(circuitikz)?

huangapple
  • 本文由 发表于 2023年5月21日 01:03:55
  • 转载请务必保留本文链接:https://go.coder-hub.com/76296415.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定