How to include \index{} in new command (custom macro)?
When I try to used \index{} inside of \newcommand, the entry is made in
the index, however, the text no longer appears in the body. How can I
achieve a macro for the \index command?
\documentclass[12pt]{article}
\usepackage{fontspec}
\newcommand{\myentry}[1]{This is an #1}
\begin{document}
\myentry{Apple}
\end{document}
typesets:
\documentclass[12pt]{article}
\usepackage{fontspec}
\usepackage{makeidx}
\makeindex
\newcommand{\md}[1]{This is an \index{#1}}
\begin{document}
\md{Apple}
\printindex
\end{document}
typesets:
No comments:
Post a Comment