如何将枚举图像的标签放在图像的左中间?

如何将枚举图像的标签放在图像的左中间?

可能重复:
将枚举标签与图像顶部对齐?

当前代码在枚举图像的左下角生成标签。

在此处输入图片描述

\documentclass[a6paper]{article}
\usepackage{geometry,graphicx,multicol,enumerate}
\columnsep=5pt

\begin{document}
\begin{enumerate}[\bf 1.]
\item Which is the correct diagram?
    \begin{multicols}{2}
        \begin{enumerate}[a.]
            \item \includegraphics[width=\linewidth]{example-image-A}           
            \item \includegraphics[width=\linewidth]{example-image-B}
            \item \includegraphics[width=\linewidth]{example-grid-100x100pt}            
            \item \includegraphics[width=\linewidth]{example-image-A}           
            \item \includegraphics[width=\linewidth]{example-image-B}
        \end{enumerate}
    \end{multicols}
\item What is your name?
\end{enumerate}
\end{document}

如何将枚举图像的标签放在图像的左中间位置?

答案1

在此处输入图片描述

\documentclass[a6paper]{article}
\usepackage{geometry,graphicx,multicol,enumerate,adjustbox}
\columnsep=5pt
\def\importgraphics#1{\adjustbox{valign=m}{\includegraphics[width=\linewidth]{#1}}}

\begin{document}
\begin{enumerate}[\bfseries 1.]
\item Which is the correct diagram?
    \begin{multicols}{2}
        \begin{enumerate}[a.]
            \item \importgraphics{example-image-A}
            \item \importgraphics{example-image-B}
            \item \importgraphics{example-grid-100x100pt}           
            \item \importgraphics{example-image-A}          
            \item \importgraphics{example-image-B}
        \end{enumerate}
    \end{multicols}
\item What is your name?
\end{enumerate}
\end{document}

相关内容