两张图片的子标题底部对齐

两张图片的子标题底部对齐

如何修复对齐,以便两个子图都底部对齐?

\documentclass[]{article}
\usepackage{subcaption}
\usepackage{tikz}
\usetikzlibrary{shapes.misc}

%opening

\begin{document}

\begin{figure}

    \begin{subfigure}[b]{0.3\textwidth}

        \begin{tikzpicture}
        \node[shape=circle,draw=black, ] (B) at (0,1) {};
        \node[shape=circle,draw=black,] (C) at (0,2) {};
        \node[shape=circle,draw=black, ] (A) at (0,0) {};




        \end{tikzpicture}

    \end{subfigure}
    %\hfill
    \begin{subfigure}[b]{0.5\textwidth}
        \[
        \left(\begin{array}{cccccc}
        &    &  &  & &\\
        &    &       &     &     &  \\ 
        &  &     &      &       & \\
        &    &      &      &     &  \\
         &  &       &       &       & \\
         &   &      &      &    &
        \end{array}\right)
        \]
    \end{subfigure}
    \caption{Edysdfsdfsdf}
\end{figure}


\end{document}

答案1

使用作为和baseline=(current bounding box.center)的选项:tikzpicture
\begin{array}[c]

根据所需的对齐方式,您可能需要调整两个子图的宽度以确保标题水平居中。

在此处输入图片描述

\documentclass[]{article}
\usepackage{subcaption}
\usepackage{tikz}
\usetikzlibrary{shapes.misc}

%opening

\begin{document}

\begin{figure}

    \begin{subfigure}[b]{0.3\textwidth}

        \begin{tikzpicture}[baseline=(current bounding box.center)]
        \node[shape=circle,draw=black, ] (B) at (0,1) {};
        \node[shape=circle,draw=black,] (C) at (0,2) {};
        \node[shape=circle,draw=black, ] (A) at (0,0) {};
        \end{tikzpicture}

    \end{subfigure}
    %\hfill
    \begin{subfigure}[b]{0.5\textwidth}
        \[
        \left(\begin{array}[c]{cccccc}
        &    &  &  & &\\
        &    &       &     &     &  \\ 
        &  &     &      &       & \\
        &    &      &      &     &  \\
         &  &       &       &       & \\
         &   &      &      &    &
        \end{array}\right)
        \]
    \end{subfigure}
    \caption{Edysdfsdfsdf}
\end{figure}


\end{document}

相关内容