在 Xelatex 中使用圖像作為 dingbat

在 Xelatex 中使用圖像作為 dingbat

我目前有一個大型文檔,在節和子節名稱中使用 dingbats 來表示特定類型的節,目前使用 Pifont 和宏化頂客命令,以便在需要時輕鬆更改圖示。我想知道是否可以使用 PNG 圖像作為自訂裝飾來實現此目的。我的程式碼的刪節、精簡版本如下所示;真實的文檔使用的包比這個多得多。

\documentclass[a4paper]{book}
\usepackage{fontspec}
\usepackage{pifont}
\usepackage{lipsum}
\usepackage{titlesec}
%
\setmainfont[Ligatures=TeX]{Caladea}
%
\newcommand*{\wc}{\ding{71} }
%
\begin{document}
\section*{Section Foo Here}
\subsection*{\wc Subsection Bar Here}
\subsection*{\wc Subsection Foobar Here}
\lipsum
\end{document}

答案1

在此輸入影像描述

\documentclass[a4paper]{book}
\usepackage{fontspec}
\usepackage{graphicx}
\usepackage{lipsum}
\usepackage{titlesec}
%
%\setmainfont[Ligatures=TeX]{Caladea}
%
\newcommand*{\wc}{\includegraphics[height=1em]{house.png}}
%
\begin{document}
\section*{Section Foo Here}
\subsection*{\wc Subsection Bar Here}
\subsection*{\wc Subsection Foobar Here}
\lipsum
\end{document}

相關內容