MakeIndex, Nomenclature, Glossaries and Acronyms ⇒ Marking the keywords in the text?
Marking the keywords in the text?
using the keywords is working pretty well, but I think it's a good thing that the used kewords can be identified in the text itself so I know "ah, I can lookup this word". Are there any possibilities to mark all the keywords in a special style, maybe via definition in the preamble? Can you recomment something?
Thanks for your time!
cheers,
Thowi
Learn LaTeX easily with newest books:
The LaTeX Beginner's Guide: 2nd edition and perfect for students writing a thesis
The LaTeX Cookbook: 2nd edition full of practical examples for mathematics, physics, chemistry, and more
LaTeX Graphics with TikZ: the first book about TikZ for perfect drawings in your LaTeX thesis
- Johannes_B
- Site Moderator
- Posts: 4182
- Joined: Thu Nov 01, 2012 4:08 pm
Marking the keywords in the text?
Best regards
Johannes
Marking the keywords in the text?
Welcome to the LaTeX community!
Please try to clarify what you're talking about. Do you want to mark the indexed words in the text? (And if so, why? The only books where I knows this kind of markup are encyclopedias and the like).thowi wrote:using the keywords is working pretty well,/quote]
Using which keywords where? And to do what? I have no idea what you're talking about. The only hint I have is that this question is somehow related to generating an index since it is posted in the “makeindex” forum...
thowi wrote:Are there any possibilities to mark all the keywords in a special style, maybe via definition in the preamble? Can you recomment something?
Regards
Marking the keywords in the text?
Thank you for your answers so far.
A document could look like this:
Code: Select all
\begin{document}
Dies ist ein neues Dokument\index{Dokument: Dies ist ein Stichwort.}.
\end{document}
Yes, that's it! I would like to mark the indexed words in the text, so in the above mentioned example I would like to mark the word "Dokument". I'm using LyX and already looked up the manuals but couldn't find any information about this topic.cgnieder wrote:Do you want to mark the indexed words in the text?
cheers,
thowi
Marking the keywords in the text?
Code: Select all
\documentclass{article}
% preamble code:
\usepackage{imakeidx}
\makeindex
\newcommand*\Index[2][]{%
$\rightarrow$~#2%
% use the mandatory argument for indexing if no optional argument is given
\if\relax\detokenize{#1}\relax
\index{#2}%
\else
% otherwise use the optional argument:
\index{#1}%
\fi
}
\begin{document}
Dies ist ein neues \Index[Dokument: Dies ist ein Stichwort.]{Dokument}.
Hier ist ein weiteres \Index{Beispiel} ohne optionales \Index{Argument}.
\printindex
\end{document}
\Index{<mandatory>}
or \Index[<optional>]{<mandatory>}
as ERT.Regards
Marking the keywords in the text?
Yes exactly, this looks like a solution for my question, thank you very much!
I think it doesn't work with LyX but I'm not exactly sure why. Normally LyX uses
makeindex
for generating the index. Maybe the package loading of imakeidx
is restricted - strange. I will try a few things and when I got it working, I will come back to you guys 
Thanks for your kind help!
Marking the keywords in the text?
makeindex
run. Just leave it out and generate your index as usual and all should be fine.Regards
Marking the keywords in the text?
Code: Select all
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% User specified LaTeX commands.
\newcommand*\Index[2][]
{%
$\rightarrow$~#2%
% use the mandatory argument for indexing if no optional argument is given
\if\relax\detokenize{#1}\relax
\index{#2}%
\else
% otherwise use the optional argument:
\index{#1}%
\fi
}
\makeatother
\begin{document}
Text
test\index{test: blablablablbalblba}
text
blabla
\printindex{}
\end{document}
Marking the keywords in the text?
My
test\index{...
needs to be test\Index{...
.It's case sensitive. And changing your Preamble to "i" doesn't work because "index" is already defined... mh. Ok, I could use the normal TeX Code with capital "Index", which would solve the problem.
Marking the keywords in the text?
That's true. One can however redefinethowi wrote:Ah okay, I got it!
Mytest\index{...
needs to betest\Index{...
.
It's case sensitive. And changing your Preamble to "i" doesn't work because "\index
" is already defined.
\index
to have the new definition. We need to save the old definition, though, as it is used in the new one:Code: Select all
\makeatletter
\let\original@index\index
\renewcommand*\index[2][]{%
$\rightarrow$~#2%
% use the mandatory argument for indexing if no optional argument is given
\if\relax\detokenize{#1}\relax
\original@index{#2}%
\else
% otherwise use the optional argument:
\original@index{#1}%
\fi
}
\makeatother
Regards