如何给我的图表添加标题

如何给我的图表添加标题

在我的工作中有两个图,我想分别添加标题作为图 (i) 和图 (ii)。

梅威瑟:

\documentclass{article}
\usepackage[
a4paper,top=1in,bottom=1in,left=0.7in,right=0.7in,headheight=14.5pt,]{geometry}
\usepackage{tkz-euclide}
\usetkzobj{all}
\begin{document}
    \large
\begin{tikzpicture}
\tkzDefPoint(4,0){A}
\tkzDefPoint(2,4){B}
\tkzDefPoint(0,0){C}
\tkzDrawPolygon(A,C,B)
\tkzLabelPoints[right,yshift=0pt](A)
\tkzLabelPoints[left,yshift=0pt](C)
\tkzLabelPoints[above,yshift=0pt](B)
\hspace{6cm}
\tkzDefPoint(4,0){A}
\tkzDefPoint(2,4){B}
\tkzDefPoint(0,0){C}
\tkzDrawPolygon(A,C,B)
\tkzLabelPoints[right,yshift=0pt](A)
\tkzLabelPoints[left,yshift=0pt](C)
\tkzLabelPoints[above,yshift=0pt](B)
\end{tikzpicture}

\end{document}

答案1

您需要有两个tikzpictures 来将它们分别放入 内subfigure

\documentclass{article}
\usepackage[
a4paper,top=1in,bottom=1in,left=0.7in,right=0.7in,headheight=14.5pt,]{geometry}
\usepackage{tkz-euclide}
\usepackage{subcaption}
\usetkzobj{all}
\begin{document}
\begin{figure}
    \centering
    \begin{subfigure}{6cm}
    \centering
    \begin{tikzpicture}
        \tkzDefPoint(4,0){A}
        \tkzDefPoint(2,4){B}
        \tkzDefPoint(0,0){C}
        \tkzDrawPolygon(A,C,B)
        \tkzLabelPoints[right,yshift=0pt](A)
        \tkzLabelPoints[left,yshift=0pt](C)
        \tkzLabelPoints[above,yshift=0pt](B)
    \end{tikzpicture}
    \caption{Local caption}
    \end{subfigure}
    \begin{subfigure}{6cm}
    \centering
    \begin{tikzpicture}
        \tkzDefPoint(4,0){A}
        \tkzDefPoint(2,4){B}
        \tkzDefPoint(0,0){C}
        \tkzDrawPolygon(A,C,B)
        \tkzLabelPoints[right,yshift=0pt](A)
        \tkzLabelPoints[left,yshift=0pt](C)
        \tkzLabelPoints[above,yshift=0pt](B)
    \end{tikzpicture}
    \caption{Local caption}
    \end{subfigure}
    \caption{Normal caption}
    \label{fig:my_label}
\end{figure}
\end{document}

在此处输入图片描述

相关内容