子图标题对齐不正确

子图标题对齐不正确

我有以下带有两张 tikz 图片的代码(我不是专家,如果可以简化的话很抱歉)

\documentclass{article}
\usepackage{tikz}

\usepackage[
format={hang},
figurename=Figura,
labelfont={bf,normalsize},
textfont={small},
labelsep=quad,
justification={justified},
width=.75\textwidth
]{caption}

\usepackage[
labelfont={bf,normalsize},
labelformat=parens,
labelsep=none,
]{subcaption}


\begin{figure}[H]
\centering
\begin{subfigure}{.2\linewidth}
    \begin{tikzpicture}[line width=1.5pt]
    \draw[black,fill=cyan] (0,0) -- (2cm,0) arc (0:45:2cm) -- cycle;
    \draw[black,fill=cyan] (0,0) -- (45:2cm) arc (45:90:2cm) -- cycle; 
    \draw[black,fill=cyan] (0,0) -- (90:2cm) arc (90:135:2cm) --cycle;
    \draw[black] (0,0) -- (135:2cm) arc (135:180:2cm) --cycle;  
    \draw[black] (0,0) -- (180:2cm) arc (180:225:2cm) --cycle; 
    \draw[black] (0,0) -- (225:2cm) arc (225:270:2cm) --cycle; 
    \draw[black] (0,0) -- (270:2cm) arc (270:315:2cm) --cycle; 
    \draw[black] (0,0) -- (315:2cm) arc (315:360:2cm) --cycle; 
    \end{tikzpicture}
    \caption{}
\end{subfigure}
\hspace{4cm}
\begin{subfigure}{.2\linewidth}
    \begin{tikzpicture}[line width=1.5pt]
    \draw[black,fill=orange] (0,0) -- (2cm,0) arc (0:30:2cm) -- cycle;
    \draw[black,fill=orange] (0,0) -- (30:2cm) arc (30:60:2cm) -- cycle; 
    \draw[black,fill=orange] (0,0) -- (60:2cm) arc (60:90:2cm) --cycle;
    \draw[black,fill=orange] (0,0) -- (90:2cm) arc (90:120:2cm) --cycle;  
    \draw[black,fill=orange] (0,0) -- (120:2cm) arc (120:150:2cm) --cycle; 
    \draw[black,fill=orange] (0,0) -- (150:2cm) arc (150:180:2cm) --cycle; 
    \draw[black,fill=orange] (0,0) -- (180:2cm) arc (180:210:2cm) --cycle; 
    \draw[black] (0,0) -- (210:2cm) arc (210:240:2cm) --cycle;
    \draw[black] (0,0) -- (240:2cm) arc (240:270:2cm) --cycle; 
    \draw[black] (0,0) -- (270:2cm) arc (270:300:2cm) --cycle;
    \draw[black] (0,0) -- (300:2cm) arc (300:330:2cm) --cycle;
    \draw[black] (0,0) -- (330:2cm) arc (330:360:2cm) --cycle;
    \end{tikzpicture}
    \caption{}
\end{subfigure}
\caption{Some text}
\end{figure}

问题是两个子图的标题没有与圆心垂直对齐。我该如何实现?我尝试使用子标题的缩进和边距选项,但没有任何效果

答案1

调整子图小页面的宽度,它们现在太窄了。我猜你想让这些圆圈居中,添加\centering

very23MinipageAlignCaption

\documentclass{article}
\usepackage{tikz}

\usepackage[
    format={hang},
    figurename=Figura,
    labelfont={bf,normalsize},
    textfont={small},
    labelsep=quad,
    justification={justified},
    width=.75\textwidth
]{caption}

\usepackage[
    labelfont={bf,normalsize},
    labelformat=parens,
    labelsep=none,
]{subcaption}


\begin{document}
\begin{figure}
    \centering
    \begin{subfigure}{.4\linewidth}
        \centering
        \begin{tikzpicture}[line width=1.5pt]
            \draw[black,fill=cyan] (0,0) -- (2cm,0) arc (0:45:2cm) -- cycle;
            \draw[black,fill=cyan] (0,0) -- (45:2cm) arc (45:90:2cm) -- cycle; 
            \draw[black,fill=cyan] (0,0) -- (90:2cm) arc (90:135:2cm) --cycle;
            \draw[black] (0,0) -- (135:2cm) arc (135:180:2cm) --cycle;  
            \draw[black] (0,0) -- (180:2cm) arc (180:225:2cm) --cycle; 
            \draw[black] (0,0) -- (225:2cm) arc (225:270:2cm) --cycle; 
            \draw[black] (0,0) -- (270:2cm) arc (270:315:2cm) --cycle; 
            \draw[black] (0,0) -- (315:2cm) arc (315:360:2cm) --cycle; 
        \end{tikzpicture}
        \caption{}
    \end{subfigure}\hfill
    \begin{subfigure}{.4\linewidth}
    \centering
        \begin{tikzpicture}[line width=1.5pt]
            \draw[black,fill=orange] (0,0) -- (2cm,0) arc (0:30:2cm) -- cycle;
            \draw[black,fill=orange] (0,0) -- (30:2cm) arc (30:60:2cm) -- cycle; 
            \draw[black,fill=orange] (0,0) -- (60:2cm) arc (60:90:2cm) --cycle;
            \draw[black,fill=orange] (0,0) -- (90:2cm) arc (90:120:2cm) --cycle;  
            \draw[black,fill=orange] (0,0) -- (120:2cm) arc (120:150:2cm) --cycle; 
            \draw[black,fill=orange] (0,0) -- (150:2cm) arc (150:180:2cm) --cycle; 
            \draw[black,fill=orange] (0,0) -- (180:2cm) arc (180:210:2cm) --cycle; 
            \draw[black] (0,0) -- (210:2cm) arc (210:240:2cm) --cycle;
            \draw[black] (0,0) -- (240:2cm) arc (240:270:2cm) --cycle; 
            \draw[black] (0,0) -- (270:2cm) arc (270:300:2cm) --cycle;
            \draw[black] (0,0) -- (300:2cm) arc (300:330:2cm) --cycle;
            \draw[black] (0,0) -- (330:2cm) arc (330:360:2cm) --cycle;
        \end{tikzpicture}
        \caption{}
    \end{subfigure}
    \caption{Some text}
\end{figure}
\end{document}

答案2

使用\subcaptionbox,这样您就不必猜测子图的大小。

\documentclass{article}
\usepackage{tikz}

\usepackage[
  format=hang,
  figurename=Figura,
  labelfont=bf,
  font=small,
  labelsep=quad,
  justification={justified},
  width=.75\textwidth
]{caption}

\usepackage[
  labelfont={bf,small},
  labelformat=parens,
  labelsep=none,
]{subcaption}

\begin{document}

\begin{figure}[htp]
\centering
\subcaptionbox{}{%
    \begin{tikzpicture}[line width=1.5pt]
    \draw[black,fill=cyan] (0,0) -- (2cm,0) arc (0:45:2cm) -- cycle;
    \draw[black,fill=cyan] (0,0) -- (45:2cm) arc (45:90:2cm) -- cycle; 
    \draw[black,fill=cyan] (0,0) -- (90:2cm) arc (90:135:2cm) --cycle;
    \draw[black] (0,0) -- (135:2cm) arc (135:180:2cm) --cycle;  
    \draw[black] (0,0) -- (180:2cm) arc (180:225:2cm) --cycle; 
    \draw[black] (0,0) -- (225:2cm) arc (225:270:2cm) --cycle; 
    \draw[black] (0,0) -- (270:2cm) arc (270:315:2cm) --cycle; 
    \draw[black] (0,0) -- (315:2cm) arc (315:360:2cm) --cycle; 
    \end{tikzpicture}%
}%
\hspace{2cm}%
\subcaptionbox{}{%
    \begin{tikzpicture}[line width=1.5pt]
    \draw[black,fill=orange] (0,0) -- (2cm,0) arc (0:30:2cm) -- cycle;
    \draw[black,fill=orange] (0,0) -- (30:2cm) arc (30:60:2cm) -- cycle; 
    \draw[black,fill=orange] (0,0) -- (60:2cm) arc (60:90:2cm) --cycle;
    \draw[black,fill=orange] (0,0) -- (90:2cm) arc (90:120:2cm) --cycle;  
    \draw[black,fill=orange] (0,0) -- (120:2cm) arc (120:150:2cm) --cycle; 
    \draw[black,fill=orange] (0,0) -- (150:2cm) arc (150:180:2cm) --cycle; 
    \draw[black,fill=orange] (0,0) -- (180:2cm) arc (180:210:2cm) --cycle; 
    \draw[black] (0,0) -- (210:2cm) arc (210:240:2cm) --cycle;
    \draw[black] (0,0) -- (240:2cm) arc (240:270:2cm) --cycle; 
    \draw[black] (0,0) -- (270:2cm) arc (270:300:2cm) --cycle;
    \draw[black] (0,0) -- (300:2cm) arc (300:330:2cm) --cycle;
    \draw[black] (0,0) -- (330:2cm) arc (330:360:2cm) --cycle;
    \end{tikzpicture}%
}
\caption{Some text}
\end{figure}

\end{document}

我改变了一些设置:标签“Figura 1”的字体大小比标题大是没有意义的;我也减小了子标题的字体大小以匹配。

在此处输入图片描述

相关内容