Ausrichtung von Grafiken mit Tabularx und Subfloats

Ausrichtung von Grafiken mit Tabularx und Subfloats

ich versuche, Grafiken innerhalb einer tabularxUmgebung auszurichten subfloats.

Grundsätzlich möchte ich einen Prozess/Arbeitsablauf mit 5 Grafiken darstellen, wobei 1-3 „verbunden“ sind und 4+5.

Dies ist mein Code: Ich habe zwei verschiedene Ansätze ausprobiert, aber beide sind nicht sehr gut aufeinander abgestimmt:

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

Das Problem ist, dass ich die Pfeile vertikal und horizontal in jeder Zeile zentriert haben möchte. Aber das ist mein Ergebnis:

Bildbeschreibung hier eingeben Bildbeschreibung hier eingeben


und so sollte es aussehen:

Bildbeschreibung hier eingeben

Kann mir jemand einen Hinweis zur Ausrichtung geben (oder ggf. einen anderen Ansatz, um das Problem zu beheben)?

Antwort1

Sie können einige Kombinationen von verwenden \makebox.

Das \vcenterobjectMakro verschiebt sein Argument vertikal, sodass die Höhe der Tiefe entspricht.

Der \makebox[0pt]{...}Befehl erstellt ein Feld mit der Breite Null, das zwischen den „Spalten“ sitzt.

Beachten Sie, dass Sie aufgrund ungeschützter Zeilenenden mehrere unzulässige Leerzeichen haben. Ich habe auch die Definition der Pfeile vereinfacht.

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

Bildbeschreibung hier eingeben

Antwort2

Aus Sicht der TeX-Grundelemente müssen Sie etwa Folgendes tun:

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

verwandte Informationen