使用图片项目符号列出/逐项列出

使用图片项目符号列出/逐项列出

我想要一些类似项目符号的东西,但带有图像,我找到了一个例子,但它对齐得不太好。文本应该与图像的中心对齐,图像(最好是它的中心)应该与其他段落对齐。

这是错误结果和正确结果的对比: 在此处输入图片描述

示例代码,这只是一个实现,请随意按照你的方式进行:

\documentclass[a4paper]{article}

\usepackage[english]{babel}
\usepackage[utf8x]{inputenc}
\usepackage{amsmath}
\usepackage{graphicx}
\usepackage[colorinlistoftodos]{todonotes}

    \newcommand*{\warn}{%
     \item[{\includegraphics[width=0.6cm]{Trees5}}]%
    }

\title{Your Paper}
\author{You}



\begin{document}
Once upon a time, there was a little girl who lived in a village near the forest.  Whenever she went out, the little girl wore a red riding cloak, so everyone in the village called her Little Red Riding Hood.

One morning, Little Red Riding Hood asked her mother if she could go to visit her grandmother as it had been awhile since they'd seen each other.
\begin{itemize}
  \warn Granny is saved.
  \warn The wolf dies.
  \warn Hello world.
\end{itemize}

\end{document}

答案1

这是一个使用选项enumitem通过专门的gitemize列表:

\documentclass{article}
\usepackage{graphicx}
\usepackage{enumitem}
\usepackage{showframe}

\newlist{gitemize}{itemize}{4}
\setlist[gitemize,1]{
  leftmargin=\dimexpr0.3cm+\labelsep\relax,
  label={\smash{\raisebox{-0.25\height}{\includegraphics[width=0.6cm]{example-image-a}}}}
}

\begin{document}
Once upon a time, there was a little girl who lived in a village near the forest.  Whenever she went out, the little girl wore a red riding cloak, so everyone in the village called her Little Red Riding Hood.

One morning, Little Red Riding Hood asked her mother if she could go to visit her grandmother as it had been awhile since they'd seen each other.
\begin{gitemize}
  \item Granny is saved. Little Red Riding Hood asked her mother if she could go to visit her grandmother as it had been awhile since they'd seen each other.
  \item The wolf dies.
  \item Hello world.
\end{gitemize}

\end{document}

在此处输入图片描述

所有对齐参数都可轻松调整。我添加该showframe包只是为了获得文本区域的视觉指南。

答案2

这大致就是你所追求的:

在此处输入图片描述

\documentclass{article}

\usepackage{lipsum,graphicx}

\newcommand{\parimage}{%
  \par\noindent
  \smash{%
    \makebox[0pt]{%
      \raisebox{\dimexpr-.5\height+.3\baselineskip}{%
        \includegraphics[height=7pt]{example-image-1x1}%
      }%
    }%
  }%
  \hspace*{\parindent}}

\begin{document}

Once upon a time, there was a little girl who lived in a village near the forest. 
Whenever she went out, the little girl wore a red riding cloak, so everyone in the 
village called her Little Red Riding Hood.

One morning, Little Red Riding Hood asked her mother if she could go to visit her 
grandmother as it had been awhile since they'd seen each other.

\parimage Granny is saved.

\parimage The wolf dies.

\lipsum[2]

\end{document}

可以调整图像和段落文本的对齐方式。

相关内容