我没能像这样将所有标题放在每个子图的中心。我认为左侧部分的标题(四个子图“A”)不在中心。右侧部分的标题(四个依赖项)在左侧对齐,并且标题的线宽也不正确。有人能帮我解决这个问题吗?我只想让每个标题居中。
\documentclass[11pt,a4paper]{article}
\usepackage{bbm}
\usepackage{times}
\usepackage{latexsym}
\usepackage{graphicx}
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{url}
\usepackage{mathtools}
\usepackage{verbatim}
\usepackage[utf8]{inputenc}
\usepackage[shellescape]{gmp}
\usepackage{dot2texi}
\usepackage{tikz}
\usetikzlibrary{shapes,arrows}
\usepackage{natbib}
\usepackage{caption}
\usepackage{subcaption}
\usepackage{tikz-dependency}
\usepackage{wrapfig}
\usepackage{multirow}
\usepackage{pgfplots}
\usepackage{filecontents}
\usepackage[T1]{fontenc}
\usepackage{subfiles}
\usepackage{readarray}
\usepackage{xcolor}
\usepackage{import}
\usepackage{tikz}
\usepackage{tikz-dependency}
\usetikzlibrary{matrix,positioning}
\usetikzlibrary{automata,arrows}
%\usepackage{ifthen}
%\usepackage{subfiles}
%\subfile{graphs/q_value.tex}
\usetikzlibrary{calc}
\begin{document}
\tikzstyle{line}=[bend right=30,thin]
\pgfmathsetmacro\myscale{0.95}
\begin{figure*}
\centering
%\begin{minipage}{0.48\linewidth}
%The first part of subfigure
\begin{minipage}[h]{.60\textwidth}
\begin{subfigure}[t]{0.475\textwidth}
\centering
\includegraphics[scale=.45]{example-image-a}
\caption*{(1) 1st iteration}
\end{subfigure}
\hfill
\begin{subfigure}[t]{0.475\textwidth}
\centering
\includegraphics[scale=.45]{example-image-a}
\caption*{(2) 2nd iteration}
\end{subfigure}
\begin{subfigure}[t]{0.475\textwidth}
\centering
\includegraphics[scale=.45]{example-image-a}
\caption*{(3) 3rd iteration}
\end{subfigure}
\hfill
\begin{subfigure}[t]{0.475\textwidth}
\centering
\includegraphics[scale=.45]{example-image-a}
\caption*{(4) Final prediction}
\end{subfigure}
\end{minipage}
\hfill
\begin{minipage}[h]{.30\textwidth}
\begin{subfigure}[t]{0.475\textwidth}
\centering
\begin{dependency}[theme = simple]
\begin{deptext}[column sep=0.3cm, font=\normalsize]
They \& were \& not \& Poles \\
\end{deptext}
%add----
\deproot[thick,dotted,edge height=30pt]{2}{\normalsize <ROOT>}
\deproot[red, edge height=30pt]{4}{\normalsize <ROOT>}
%\depedge[]{1}{2}{}
\depedge[thick,dotted]{2}{1}{}
\depedge[thick,dotted]{2}{3}{}
\depedge[]{2}{4}{}
\end{dependency}
\caption*{(1) 1st iteration}
\end{subfigure}
\begin{subfigure}[t]{0.475\textwidth}
\centering
\begin{dependency}[theme = simple]
\begin{deptext}[column sep=0.3cm, font=\normalsize]
They \& were \& not \& Poles \\
\end{deptext}
%add----
\deproot[thick,dotted,edge height=30pt]{2}{\normalsize <ROOT>}
%\deproot[edge height=30pt]{3}{\normalsize ROOT}
%\depedge[]{1}{2}{}
\depedge[thick,dotted]{2}{1}{}
\depedge[thick,dotted]{2}{3}{}
\depedge[thick,dotted]{2}{4}{}
\end{dependency}
\caption*{(2) 2nd iteration}
\end{subfigure}
\begin{subfigure}[t]{0.475\textwidth}
\centering
\begin{dependency}[theme = simple]
\begin{deptext}[column sep=0.3cm, font=\normalsize]
They \& were \& not \& Poles \\
\end{deptext}
%add----
\deproot[edge height=30pt]{2}{\normalsize <ROOT>}
%\deproot[edge height=30pt]{3}{\normalsize ROOT}
%\depedge[]{1}{2}{}
\depedge[thick,dotted]{2}{1}{}
\depedge[thick,dotted]{2}{3}{}
\depedge[]{2}{4}{}
\end{dependency}
\caption*{(3) 3rd iteration}
\end{subfigure}
\begin{subfigure}[t]{0.475\textwidth}
\centering
\begin{dependency}[theme = simple]
\begin{deptext}[column sep=0.3cm, font=\normalsize]
They \& were \& not \& Poles \\
\end{deptext}
%add----
\deproot[edge height=30pt]{2}{\normalsize <ROOT>}
%\deproot[edge height=30pt]{3}{\normalsize ROOT}
%\depedge[]{1}{2}{}
\depedge[]{2}{1}{}
\depedge[]{2}{3}{}
\depedge[]{2}{4}{}
\end{dependency}
\caption*{(4) Final prediction}
\end{subfigure}
\end{minipage}
%\end{minipage}
%End of The first part of subfigure
%The second part of subfigure
%PSD ood test set
\caption{}
\label{fig:example}
\end{figure*}
\end{document}
答案1
您需要进行两项主要调整:
在左侧
minipage
,将 的所有实例替换[scale=.45]
为[width=\textwidth]
或[width=\textwidth,height=\textwidth]
。在右侧,将
minipage
的所有实例替换为。\begin{subfigure}[t]{0.475\textwidth}
\begin{subfigure}[t]{1\textwidth}
两个附加说明:(a)不要加载过时且无人维护的latexsym
软件包。相反,加载amssmyb
软件包。(b)不要多次加载软件包——这样做不会有任何好处。
\documentclass[11pt,a4paper]{article}
\usepackage{bbm}
\usepackage{times}
%%%%\usepackage{latexsym}
\usepackage{graphicx}
\usepackage{amsmath}
\usepackage{amssymb}%%%{amsfonts}
\usepackage{url}
\usepackage{mathtools}
\usepackage{verbatim}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage[shellescape]{gmp}
\usepackage{dot2texi}
\usepackage{natbib}
\usepackage{caption}
\usepackage{subcaption}
\usepackage{wrapfig}
\usepackage{multirow}
\usepackage{pgfplots}
\usepackage{filecontents}
\usepackage{subfiles}
\usepackage{readarray}
\usepackage{xcolor}
\usepackage{import}
\usepackage{tikz}
%%%%\usepackage{tikz}
\usepackage{tikz-dependency}
%%%%\usepackage{tikz-dependency}
\usetikzlibrary{shapes,arrows}
\usetikzlibrary{matrix,positioning}
\usetikzlibrary{automata,arrows}
\usetikzlibrary{calc}
%\usepackage{ifthen}
%\usepackage{subfiles}
%\subfile{graphs/q_value.tex}
\begin{document}
\tikzstyle{line}=[bend right=30,thin]
\pgfmathsetmacro\myscale{0.95}
\begin{figure}
%\centering
%The first part of figure
\begin{minipage}[]{.60\textwidth}
\begin{subfigure}[]{0.475\textwidth}
%%%\centering
\includegraphics[width=\textwidth,height=\textwidth]{example-image-a}
\caption*{(1) 1st iteration}
\end{subfigure}%
%%%
\hfill
\begin{subfigure}[]{0.475\textwidth}
%%%\centering
\includegraphics[width=\textwidth,height=\textwidth]{example-image-a}
\caption*{(2) 2nd iteration}
\end{subfigure}
\bigskip
\begin{subfigure}[]{0.475\textwidth}
%%%\centering
\includegraphics[width=\textwidth,height=\textwidth]{example-image-a}
\caption*{(3) 3rd iteration}
\end{subfigure}%
%%%
\hfill
\begin{subfigure}[]{0.475\textwidth}
%%%\centering
\includegraphics[width=\textwidth,height=\textwidth]{example-image-a}
\caption*{(4) Final prediction}
\end{subfigure}
\end{minipage}%
%%%%%%
\hfill
\begin{minipage}[]{.38\textwidth} %Second part of figure
\begin{subfigure}[]{\textwidth}
\centering
\begin{dependency}[theme = simple]
\begin{deptext}[column sep=3mm, font=\normalsize]
They \& were \& not \& Poles \\
\end{deptext}
\deproot[thick,dotted,edge height=30pt]{2}{\normalsize <ROOT>}
\deproot[red, edge height=30pt]{4}{\normalsize <ROOT>}
%\depedge[]{1}{2}{}
\depedge[thick,dotted]{2}{1}{}
\depedge[thick,dotted]{2}{3}{}
\depedge[]{2}{4}{}
\end{dependency}
\caption*{(1) 1st iteration}
\end{subfigure}
\medskip
\begin{subfigure}[]{\textwidth}
\centering
\begin{dependency}[theme = simple]
\begin{deptext}[column sep=0.3cm, font=\normalsize]
They \& were \& not \& Poles \\
\end{deptext}
\deproot[thick,dotted,edge height=30pt]{2}{\normalsize <ROOT>}
%\deproot[edge height=30pt]{3}{\normalsize ROOT}
%\depedge[]{1}{2}{}
\depedge[thick,dotted]{2}{1}{}
\depedge[thick,dotted]{2}{3}{}
\depedge[thick,dotted]{2}{4}{}
\end{dependency}
\caption*{(2) 2nd iteration}
\end{subfigure}
\medskip
\begin{subfigure}[]{\textwidth}
\centering
\begin{dependency}[theme = simple]
\begin{deptext}[column sep=0.3cm, font=\normalsize]
They \& were \& not \& Poles \\
\end{deptext}
\deproot[edge height=30pt]{2}{\normalsize <ROOT>}
%\deproot[edge height=30pt]{3}{\normalsize ROOT}
%\depedge[]{1}{2}{}
\depedge[thick,dotted]{2}{1}{}
\depedge[thick,dotted]{2}{3}{}
\depedge[]{2}{4}{}
\end{dependency}
\caption*{(3) 3rd iteration}
\end{subfigure}
\medskip
\begin{subfigure}[]{\textwidth}
\centering
\begin{dependency}[theme = simple]
\begin{deptext}[column sep=0.3cm, font=\normalsize]
They \& were \& not \& Poles \\
\end{deptext}
\deproot[edge height=30pt]{2}{\normalsize <ROOT>}
%\deproot[edge height=30pt]{3}{\normalsize ROOT}
%\depedge[]{1}{2}{}
\depedge[]{2}{1}{}
\depedge[]{2}{3}{}
\depedge[]{2}{4}{}
\end{dependency}
\caption*{(4) Final prediction}
\end{subfigure}
\end{minipage}
\caption{}
\label{fig:example}
\end{figure}
\end{document}