tabularx とサブフロートを使用したグラフィックの配置

tabularx とサブフロートを使用したグラフィックの配置

私がやろうとしているのは、環境内でグラフィックを整列させることtabularxですsubfloats

基本的に、1 ~ 3 を「接続」し、4 + 5 の 5 つのグラフィックを使用してプロセス/ワークフローを表示したいと考えています。

これは私のコードです: 2 つの異なるアプローチを試しましたが、どちらもあまりうまく一致していません:

\documentclass{report}
\usepackage{pifont}
\usepackage[svgnames, x11names]{xcolor}
\usepackage{graphicx}
\usepackage{caption}
\usepackage{subfig}
\usepackage{tabularx}

\newcommand\bigleftArrow{\color{Tomato2}\rotatebox[origin=c]{180}{\scalebox{2.4}[3.6]{\ding{225}}}}
\newcommand\bigrightArrow{\color{Tomato2}\rotatebox[origin=c]{0}{\scalebox{2.4}[3.6]{\ding{225}}}}

\newcolumntype{C}[1]{>{\centering\let\newline\\\arraybackslash\hspace{0pt}}m{#1}}

\begin{document}

\begin{figure} [h]
\begin{tabularx}{\textwidth}{@{}*{5}{>{\centering\arraybackslash}X}@{}}
  \subfloat[text 1]{
     \includegraphics[width=0.28\textwidth]
     {example-image-a}}
      &
      \bigleftArrow
      &
  \subfloat[text 2]{
     \includegraphics[width=0.28\textwidth]
     {example-image-b}}
      &
      \bigleftArrow
      &
  \subfloat[text 3 is longer as  the others text text text text text]{
     \includegraphics[width=0.28\textwidth]
     {example-image-c}}
     \\
  \subfloat[text 4]{
     \includegraphics[width=0.28\textwidth]
     {example-image}}
       &
       &
       \bigrightArrow
       &
       &
  \subfloat[text 5]{
     \includegraphics[width=0.28\textwidth]
     {example-image}}


\end{tabularx}
  \captionof{figure}[]{long text 1}
  \label{fig:merge}
\end{figure}





\begin{figure} [hb]
\begin{tabularx}{\textwidth}{X m{10pt} C{110pt} m{10pt} X}
\centering 
  \subfloat[text 1]{
     \includegraphics[width=0.28\textwidth]
     {example-image-a}}
      &
      \bigleftArrow
      &
  \subfloat[text 2]{
     \includegraphics[width=0.28\textwidth]
     {example-image-b}}
      &
      \bigleftArrow
      &
  \subfloat[text 3 is longer as  the others text text text text text]{
     \includegraphics[width=0.28\textwidth]
     {example-image-c}}
  \\ 
  \subfloat[text4]{
     \includegraphics[width=0.28\textwidth]
     {example-image}}
      &
      &
      \bigrightArrow
      &
      &
  \subfloat[text5]{
     \includegraphics[width=0.28\textwidth]
     {example-image}}


\end{tabularx} 
  \captionof{figure}[]{long text 2}

\end{figure}

\end{document}

問題は、各行の中央に垂直と水平の矢印を配置したいということです。しかし、結果は次のようになります:

ここに画像の説明を入力してください ここに画像の説明を入力してください


そして、次のようになります:

ここに画像の説明を入力してください

誰か、アライメントに関するヒント(または、これを修正するために必要な場合は他のアプローチ)を教えてくれませんか?

答え1

のいくつかの組み合わせを使用できます\makebox

マクロ\vcenterobjectは引数を垂直方向にシフトし、高さが深さと等しくなるようにします。

この\makebox[0pt]{...}コマンドは、「列」の間に配置される幅ゼロのボックスを作成します。

保護されていない行末により、いくつかの不要なスペースがあることに注意してください。矢印の定義も簡略化しました。

\documentclass{report}
\usepackage{pifont}
\usepackage[svgnames, x11names]{xcolor}
\usepackage{graphicx}
\usepackage{caption}
\usepackage{subfig}

\newcommand\bigleftArrow{%
  \scalebox{-2.4}[3.6]{%
    \color{Tomato2}\ding{225}%
  }%
}
\newcommand\bigrightArrow{%
  \scalebox{2.4}[3.6]{%
    \color{Tomato2}\ding{225}%
  }%
}

\newcommand{\vcenterobject}[1]{%
  \begin{tabular}{@{}c@{}}#1\end{tabular}%
}

\begin{document}

\begin{figure}[htp]

\makebox[.33333\textwidth]{%
  \subfloat[text 1]{%
    \vcenterobject{%
      \includegraphics[width=0.2\textwidth]{example-image-a}%
    }%
  }
}%
\hfill\makebox[0pt]{\vcenterobject{\bigleftArrow}}\hfill
\makebox[.33333\textwidth]{%
  \subfloat[text 2]{%
    \vcenterobject{%
      \includegraphics[width=0.2\textwidth]{example-image-b}%
    }%
  }%
}%
\hfill\makebox[0pt]{\vcenterobject{\bigleftArrow}}\hfill
\makebox[.33333\textwidth]{%
  \subfloat[text 3 is longer as  the others text text text text text]{%
    \vcenterobject{%
      \includegraphics[width=0.2\textwidth]{example-image-c}%
    }%
  }%
}

\makebox[.33333\textwidth]{%
  \subfloat[text 4]{%
    \vcenterobject{%
      \includegraphics[width=0.2\textwidth]{example-image}%
    }%
  }%
}%
\hfill\makebox[0pt]{\vcenterobject{\bigrightArrow}}\hfill
\makebox[.33333\textwidth]{%
  \subfloat[text 5]{%
    \vcenterobject{%
      \includegraphics[width=0.2\textwidth]{example-image}%
    }%
  }%
}

\caption{long text 1}\label{fig:merge}

\end{figure}

\end{document}

ここに画像の説明を入力してください

答え2

TeX プリミティブの観点からは、次のようなことを行う必要があります。

\def\vhb#1{\vtop{\hbox{#1}}}
\def\rb#1{\raise.9cm\hbox{#1}}

\begin{figure}[h]
\hbox to\hsize{%
  \vhb{\subfloat[text 1]{\includegraphics[width=0.28\textwidth]{example-image-a}}}%
  \hss \rb\bigleftArrow \hss
  \vhb{\subfloat[text 2]{\includegraphics[width=0.28\textwidth]{example-image-b}}}%
  \hss \rb\bigleftArrow \hss
  \vhb{\subfloat[text 3 is longer as  the others text text text text text]{
     \includegraphics[width=0.28\textwidth]{example-image-c}}}%
}
\hbox to\hsize{%
  \vhb{\subfloat[text 4]{\includegraphics[width=0.28\textwidth]{example-image}}}%
  \hss \rb\bigrightArrow \hss
  \vhb{\subfloat[text 5]{\includegraphics[width=0.28\textwidth]{example-image}}}%
}
\end{figure}

関連情報