1

I'm struggling with template given for my article. I've got four images and I'd like to place right arrow between them.

Problem

Problem is that arrows should be in the middle instead of at the bottom.

\Teaser{
    \TeaserImage{orig.png}
    \Rightarrow
    \TeaserImage{grid.png}
    \Rightarrow
    \TeaserImage{map.png}
    \Rightarrow
    \TeaserImage{predictions.png}
}

Commands Teaser and TeaserImage are defined in template like so

\newcommand{\Teaser}[1]{\global\HaveTeasertrue\def\@Teaser{#1}}
\newcommand{\TeaserImage}[1]{\includegraphics[height=1in]{#1}}

I've tried to use vspace, but without any luck.

  • 1
    Welcome to TeX.SE! Please -- as usual here -- make your code snippet compilable! – Mensch Mar 22 at 1:16
  • Try to use \vcenter{\hbox{...}}. It is hard to test or be more detailed since you do not provide a complete code. – marmot Mar 22 at 1:19
3
\documentclass{article}
\usepackage[margin=50pt]{geometry}
\usepackage{graphicx,amssymb}
%\newcommand{\Teaser}[1]{\global\HaveTeasertrue\def\@Teaser{#1}}
\newcommand{\TeaserImage}[1]{\raisebox{%
  .5\dimexpr-\height+\ht\strutbox-\dp\strutbox}{%
  \includegraphics[height=1in]{#1}}}
\begin{document}
$%\Teaser{
    \TeaserImage{example-image}
    \Rightarrow
    \TeaserImage{example-image-a}
    \Rightarrow
    \TeaserImage{example-image-b}
    \Rightarrow
    \TeaserImage{example-image-c}
$%}
\end{document}

enter image description here

  • Thanks @Steven - this did the job well. Also is there any other way without modification of the template (TeaserImage)? – kocica Mar 22 at 1:31
  • @FilipKočica You can redefine \includegraphics, but I don't recommend it. You could modify the template by one letter, capitalizing \includegraphics to \Includegraphics, and define the latter to perform the \raisebox accordingly. – Steven B. Segletes Mar 22 at 1:47
  • @FilipKočica after loading the template, you could \let\svTeaserImage\TeaserImage \renewcommand{\TeaserImage}[1]{\raisebox{.5\dimexpr-\height+\ht\strutbox-\dp\strutbox}{\svTeaserImage{#1}}} – Steven B. Segletes Mar 22 at 1:50
  • Thanks @Steven, that's very helpful. – kocica Mar 22 at 8:49
3

Just spelling out my comment.

\documentclass{article}
\usepackage{graphicx}
\usepackage[margin=1in]{geometry}
\newcommand{\TeaserImage}[1]{\vcenter{\hbox{\includegraphics[height=1in]{#1}}}}
\begin{document}
$\TeaserImage{example-image-duck}
    \Rightarrow
    \TeaserImage{example-image-duck}
    \Rightarrow
    \TeaserImage{example-image-duck}
    \Rightarrow
    \TeaserImage{example-image-duck}$
\end{document}

enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.