0

I currently have a large document that uses dingbats in section and subsection names to denote specific kinds of sections, currently using Pifont and a macro-ised ding command, for ease of changing the icon if required. I'm wondering if it's possible to use a PNG image as a custom dingbat for this purpose. An abridged, slimmed version of my code is shown below; the real document uses far more packages than this.

\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}
4
  • you can use images in xelatex, what exactly is the question? Jan 26, 2017 at 17:19
  • \newcommand*{\wc}{\includegraphics[height=1em]{myimage.png}} ? Jan 26, 2017 at 17:20
  • I'm trying to replace the \ding with another image, currently a PNG image, to allow for custom symbols to be placed in-line with text. The \wc command currently places a star symbol within the heading; I wish to use the PNG image instead of that star.
    – Jay
    Jan 26, 2017 at 17:21
  • sure just use a definition as in my previous comment (using graphicx package) this is no different from any other image inclusion is it? Jan 26, 2017 at 17:23

1 Answer 1

1

enter image description here

\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}
4
  • uh, where's the image? don't see it ... Jan 26, 2017 at 18:39
  • @barbarabeeton it's my famous house image to the left of each Subsection Jan 26, 2017 at 18:43
  • oh. i'll have to get my monitor adjusted, i guess. it's so faint that i can't really see it, even with my "computer" spectacles on. Jan 26, 2017 at 18:53
  • This is precisely what I needed; also it turns out this question is a duplicate to tex.stackexchange.com/questions/40095/… just my Google-fu wasn't up to scratch. Thank you, David, for your timely answer.
    – Jay
    Jan 26, 2017 at 23:20

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .