MakeIndex, Nomenclature, Glossaries and Acronyms ⇒ Marking the keywords in the text?
Marking the keywords in the text?
Hey all together,
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
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
- Johannes_B
- Site Moderator
- Posts: 4182
- Joined: Thu Nov 01, 2012 4:08 pm
Marking the keywords in the text?
It would be very helpful if you could state your question in form of some code. A minimal working example would be perfect (please follow the link). That means your code is immediately compilable and we can test posibble solutions. You can state your wishes directly in the code, either as text, or asa simple comment (the %-sign in front).
Best regards
Johannes
Best regards
Johannes
The smart way: Calm down and take a deep breath, read posts and provided links attentively, try to understand and ask if necessary.
Marking the keywords in the text?
Hi Thowi,
Welcome to the LaTeX community!
Regards
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
site moderator & package author
Marking the keywords in the text?
Hi together
Thank you for your answers so far.
A document could look like this:
cheers,
thowi
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
Last edited by cgnieder on Fri Aug 16, 2013 6:52 pm, edited 1 time in total.
Marking the keywords in the text?
You could define a custom command for this. Maybe something along the following lines:
I am not familiar with LyX, though, so I don't know what the best way to do this in LyX would be. You could just insert the preamble code to the LaTeX preamble and use
Regards
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
site moderator & package author
Marking the keywords in the text?
Hi Clemens
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
Thanks for your kind help!
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?
The package imakeidx is not necessary for the solution: it just simplifies the index generation for us LaTeX users since it saves us a separate
Regards
makeindex
run. Just leave it out and generate your index as usual and all should be fine.Regards
site moderator & package author
Marking the keywords in the text?
Mh maybe I did something wrong? I just added your code into the Preamble and the appearance doesn't change:
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}
Last edited by cgnieder on Fri Aug 16, 2013 8:01 pm, edited 1 time in total.
Marking the keywords in the text?
Ah okay, I got it!
My
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.
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
site moderator & package author