4

I'm trying to include small graphics within an equation setting (they're little diagrams of mathematical knots), using \includegraphics within the \begin{align} environment. The graphics themselves are contained within angular brackets (< and >), but they will make up part of a bigger equation that will include ( and [ brackets also. The graphics are about the size that \Bigg< would contain them nicely.

My problem is that, in the pdf output, the graphics are not aligned nicely with any of the brackets. Instead, the very bottom of the graphic is in line with the middle of the brackets, which doesn't look great! I've tried using both \left< to set the size automatically and \Bigg< to do it manually, but either way, its still all vertically unaligned.

I wasn't sure how to link in an image into to my worked example, but I've uploaded it as per the instructions here trefoil.png. I guess if its downloaded and saved as 'trefoil.png' it should still work. Apologies if there is an easier way of doing it, is my first post and wasn't sure!

\documentclass[a4paper,12pt, fleqn]{amsart}
%
\usepackage{fullpage}
\usepackage{graphicx}
\usepackage{hyperref}
\usepackage{caption}
\usepackage{subcaption}
\usepackage{float}
\usepackage{amsmath}
\usepackage{toolbox}
%
\begin{document}
%
\begin{align*}
\left< \includegraphics[scale=0.02]{trefoil.png} \right> &=A\left<
\includegraphics[scale=0.02]{trefoil.png} \right> + A^{-1}\left<
\includegraphics[scale=0.02]{trefoil.png}\right>
\end{align*}
\end{document}

This is what the output ends up looking like

Thanks a lot in advance for any help!

8

I encapsulate the \includegraphics inside a \vcenter{\hbox{}}, since I am in math mode already and want the images to be centered about the math axis. I changed scale= to height/width specs, since in demo mode, the scale parameter does not really apply.

In the MWE below, I incorporate this process into a new macro \Includegraphics[]{} (with a capital I).

\documentclass[a4paper,12pt, fleqn]{amsart}
%
\usepackage{fullpage}
\usepackage[demo]{graphicx}
\usepackage{hyperref}
\usepackage{caption}
\usepackage{subcaption}
\usepackage{float}
\usepackage{amsmath}
%\usepackage{toolbox}
%
\newcommand\Includegraphics[2][]{\vcenter{\hbox{\includegraphics[#1]{#2}}}}
\begin{document}
%
\begin{align*}
\left< \Includegraphics[width=1cm,height=1cm]{trefoil.png} \right> &=A\left<
\Includegraphics[width=1.5cm,height=1.5cm]{trefoil.png} \right> + A^{-1}\left<
\Includegraphics[width=.8cm,height=.8cm]{trefoil.png}\right>
\end{align*}
\end{document}

enter image description here

  • @BW8 You are welcome. You may want to consider clicking the check mark to the left of my answer, if it provides the best/complete answer to your question. That way, other readers are informed whether or not your question has been successfully answered, and if there are multiple answers, which one you consider most helpful. Welcome to the site. – Steven B. Segletes Apr 5 '16 at 11:21
2

Try to shift image with raisebox:

\documentclass[a4paper,12pt, fleqn]{amsart}
%
\usepackage{graphicx}
\usepackage{hyperref}
%
\begin{document}
%
\begin{align*}
\left< \raisebox{-1em}{\includegraphics[scale=0.1]{example-image}} \right> 
    & = A\left<\includegraphics[scale=0.1]{example-image} \right> + 
        A^{-1}\left<\includegraphics[scale=0.1]{example-image}\right>
\end{align*}
\end{document}

Used only on left side of equations, it gives:

enter image description here

  • That's also worked nicely- thanks for your help! – BW8 Apr 5 '16 at 11:25
  • Probably \raisebox{-0.5\height}{…} would be independent of the image size. – Bernard Apr 5 '16 at 13:35
2

Just for completeness here is a solution based on adjustbox:

\documentclass[a4paper,12pt, fleqn]{amsart}
%
\usepackage{graphicx}
% overload \includegraphics with extra options
\usepackage[export]{adjustbox}
\usepackage{hyperref}
 %
\begin{document}
%
\begin{equation*}
 = A\left<
      \includegraphics[scale=0.1,valign=c]{example-image}
    \right> + 
    A^{-1}\left<\includegraphics[scale=0.1]{example-image}\right>
\end{equation*}
\end{document}

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.