tabularx 및 subfloat를 사용한 그래픽 정렬

tabularx 및 subfloat를 사용한 그래픽 정렬

내가 하려는 것은 tabularxsubfloats환경 내에서 그래픽을 정렬하는 것입니다.

기본적으로 1-3개는 "연결"되고 4+5개는 5개의 그래픽을 사용하여 프로세스/워크플로를 표시하고 싶습니다.

이것은 내 코드입니다. 두 가지 다른 접근법을 시도했지만 둘 다 잘 정렬되지 않았습니다.

\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]{...}명령은 "열" 사이에 놓일 너비가 0인 상자를 만듭니다.

보호되지 않은 줄 끝으로 인해 여러 개의 가짜 공백이 있다는 점에 유의하세요. 또한 화살표의 정의를 단순화했습니다.

\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}

관련 정보