[Tex/LaTex] Does captionsetup command works for subcaption

acmartcaptionsminipagesubcaptiontikz-pic

I am trying to place three subfigures side by side using the minipage environment.

The problem is that I cannot control the width of subcaption inside the minipage environment. I tried both captionsetup and \subcaption[] in the code below, and get this figure.

enter image description here

Apparently the three subcaptions are too close to each other. Varying the parameters of captionsetup or \subcaption[] does make any difference, whatever I tried 0.1\textwidth, 0.5\linewidth, or 1cm.

Currently, the only solution that works is to shrink the width of the minipage directly, and insert \hspace between minipages. This is inconvenient as I might update the tikz figures with different margins, and this method requires to update the parameters of both minipage and hspace.

My question is, is there any way that we can control the width of subcaption within a minipage directly?

\documentclass[sigconf, anonymous, review]{acmart}
\usepackage{booktabs}

\setcopyright{rightsretained}

\usepackage{amsmath}
%\usepackage[small]{caption}
\usepackage{graphicx}
\usepackage{subcaption}
\usepackage{tikz}
\usetikzlibrary{fit,positioning,automata,calc}

\begin{document}

\title{No title}

\maketitle

\section{PLEASE READ FROM HERE..................................}

\begin{figure}[!t]
\begin{minipage}{0.164\textwidth}% The article is double-column, I'd like to place three subfigures side-by-side in one column. 1/2/3=0.166666...
\centering
\begin{tikzpicture}
\footnotesize
\tikzstyle{main}=[circle, minimum size = 3.6mm, thick, draw =black!80, node distance = 3mm]
\tikzstyle{connect}=[-latex, thick]
  \node[main] (i)  {\scriptsize $i$};
  \node[main] (above_i) [above left=of i] {};
  \node[main] (left_i) [left=of i] {};
  \node[main] (right_i) [right=of i] {};
  \node[main] (right_above_i) [above right=of i, above left=of right_i] {};
  \path (i) edge node {} (above_i);
  \path (i) edge node {} (left_i);
  \path (i) edge node {} (right_i);
  \path (i) edge node {} (right_above_i);
  \path (above_i) edge node {} (left_i);
  \path (right_i) edge node {} (right_above_i);

\end{tikzpicture}
\captionsetup{width=0.7\textwidth}% Within this minipage environment, the local \textwidth is 1 I don't want subcpations of two subfigures too close to each other, so I use a ratio of 0.7. But it does not work.
\subcaption[width=0.7\textwidth]{the subcaption of this subfig is very long very long}
\label{fig:1}
\end{minipage}%
\begin{minipage}{0.164\textwidth}
\centering
\begin{tikzpicture}
\footnotesize
\tikzstyle{main}=[circle, minimum size = 3.6mm, thick, draw =black!80, node distance = 3mm]
\tikzstyle{connect}=[-latex, thick]
  \node[main] (i)  {\scriptsize $i$};
  \node[main] (above_i) [above left=of i] {};
  \node[main,fill=black!10] (left_i) [left=of i] {};
  \node[main] (right_i) [right=of i] {};
  \node[main] (right_above_i) [above right=of i, above left=of right_i] {};
  \path (i) edge node {} (above_i);
  \path (i) edge node {} (left_i);
  \path (i) edge node {} (right_i);
  \path (i) edge node {} (right_above_i);
  \path (above_i) edge node {} (left_i);
  \path (right_i) edge node {} (right_above_i);

\end{tikzpicture}
\captionsetup{width=0.7\textwidth}
\subcaption{\small the subcaption of this subfig is very long very long}
\label{fig:2}
\end{minipage}%
\begin{minipage}{0.164\textwidth}
\centering
\begin{tikzpicture}
\footnotesize
\tikzstyle{main}=[circle, minimum size = 3.6mm, thick, draw =black!80, node distance = 3mm]
\tikzstyle{connect}=[-latex, thick]
  \node[main] (i)  {\scriptsize $i$};
  \node[main] (above_i) [above left=of i] {};
  \node[main] (left_i) [left=of i] {};
  \node[main] (right_i) [right=of i] {};
  \node[main,fill=black!10] (right_above_i) [above right=of i, above left=of right_i] {};
  \path (i) edge node {} (above_i);
  \path (i) edge node {} (left_i);
  \path (i) edge node {} (right_i);
  \path (i) edge node {} (right_above_i);
  \path (above_i) edge node {} (left_i);
  \path (right_i) edge node {} (right_above_i);

\end{tikzpicture}
\captionsetup{width=0.7\textwidth}%
\subcaption{\small the subcaption of this subfig is very long very long}
\label{fig:3}
\end{minipage}
\captionsetup{width=0.4\textwidth}
\caption{\small this caption is the caption to all the three sub-figures}
\vspace{-0.2cm}
\end{figure}


\end{document}

Best Answer

You can avoid most of your computations:

\documentclass[sigconf, anonymous, review]{acmart}

\usepackage{booktabs}
\usepackage{amsmath}
\usepackage{graphicx}
\usepackage{subcaption}
\usepackage{tikz}
\usetikzlibrary{fit,positioning,automata,calc}

\setcopyright{rightsretained}

% general options for subfigure captions
\captionsetup[subfigure]{
  font=footnotesize,
  justification=raggedright
}

\begin{document}

\title{No title}

\maketitle

\section{PLEASE READ FROM HERE..................................}

\begin{figure}[!ht]

% local setting for subfigure captions
\captionsetup[subfigure]{margin=0.1\columnwidth}

\begin{subfigure}{0.33333\columnwidth}
\centering
\begin{tikzpicture}
\tikzstyle{main}=[circle, minimum size = 3.6mm, thick, draw =black!80, node distance = 3mm]
\tikzstyle{connect}=[-latex, thick]
  \node[main] (i)  {\scriptsize $i$};
  \node[main] (above_i) [above left=of i] {};
  \node[main] (left_i) [left=of i] {};
  \node[main] (right_i) [right=of i] {};
  \node[main] (right_above_i) [above right=of i, above left=of right_i] {};
  \path (i) edge node {} (above_i);
  \path (i) edge node {} (left_i);
  \path (i) edge node {} (right_i);
  \path (i) edge node {} (right_above_i);
  \path (above_i) edge node {} (left_i);
  \path (right_i) edge node {} (right_above_i);
\end{tikzpicture}
\caption{the subcaption of this subfig is very long very long}
\label{fig:1}
\end{subfigure}\hfill
\begin{subfigure}{0.33333\columnwidth}
\centering
\begin{tikzpicture}
\tikzstyle{main}=[circle, minimum size = 3.6mm, thick, draw =black!80, node distance = 3mm]
\tikzstyle{connect}=[-latex, thick]
  \node[main] (i)  {\scriptsize $i$};
  \node[main] (above_i) [above left=of i] {};
  \node[main,fill=black!10] (left_i) [left=of i] {};
  \node[main] (right_i) [right=of i] {};
  \node[main] (right_above_i) [above right=of i, above left=of right_i] {};
  \path (i) edge node {} (above_i);
  \path (i) edge node {} (left_i);
  \path (i) edge node {} (right_i);
  \path (i) edge node {} (right_above_i);
  \path (above_i) edge node {} (left_i);
  \path (right_i) edge node {} (right_above_i);
\end{tikzpicture}
\subcaption{the subcaption of this subfig is very long very long}
\label{fig:2}
\end{subfigure}\hfill
\begin{subfigure}{0.33333\columnwidth}
\centering
\begin{tikzpicture}
\tikzstyle{main}=[circle, minimum size = 3.6mm, thick, draw =black!80, node distance = 3mm]
\tikzstyle{connect}=[-latex, thick]
  \node[main] (i)  {\scriptsize $i$};
  \node[main] (above_i) [above left=of i] {};
  \node[main] (left_i) [left=of i] {};
  \node[main] (right_i) [right=of i] {};
  \node[main,fill=black!10] (right_above_i) [above right=of i, above left=of right_i] {};
  \path (i) edge node {} (above_i);
  \path (i) edge node {} (left_i);
  \path (i) edge node {} (right_i);
  \path (i) edge node {} (right_above_i);
  \path (above_i) edge node {} (left_i);
  \path (right_i) edge node {} (right_above_i);
\end{tikzpicture}
\subcaption{the subcaption of this subfig is very long very long}
\label{fig:3}
\end{subfigure}

\caption{this caption is the caption to all the three sub-figures}

\end{figure}

\end{document}

enter image description here