1

I'm doing a translation of the Zohar (more than 2000pages) in LyX. There are terms that appear a lot in the text and I'd like not to click with the search button to identify all the occurence of a term in the text but only write the term once e.g. "Elohim" and having it selected and automatically indexed for all the occurences in the text. Is that possibile? Thank you!

Dac0
  • 133

1 Answers1

2

Following my answer in How to ensure that all pages corresponding to the entries appear in the index are shown?

To adapt this to LyX you only must be aware of what part of this code could be produced by LyX automatically, and what code you must include explicitly. One way to do with an empty new document:

(1) Open the Code preview Pane to verify what is really made with every action.

(2) Add the text "ELISA and PCR", make the word "ELISA" an index entry manually. Then add the Index List as usual in LyX:

mwe

The first action will add \index{ELISA} in text but also \usepackage{makeidx}\makeindex, so you should not include it again in the preamble, whereas the "Index" cyan box simply will add \printindex after the text.

(3) In Document > Settings... > LaTeX Preamble add the xesearch code. For instance, this simplified version:

\usepackage{xesearch}
\SearchList{index}{#1\index{{#1}}}{ELISA,PCR}

(4) Optionally, you can include also \usepackage[colorlinks]{hyperref} here, or alternatively add the hyperref support in Document > Settings... > PDF Properties, but be sure of not load it twice!

(5) In order to not index also the index list, between the text and the list, add with Ctrl+L \StopList{index}

mwe2

(6) Finally, document are made by default to PDF(pdflatex) format, but xesearch package must be compiled with the format PDF (XeTeX). Although simply View/export in this format could work with this MWE, it is better go to Document > Settings... > Fonts > Check "Use non-TeX fonts", so it will be compiled by default with XeTeX

And that is all. Without hyperref, with Ctrl-R, you will see in the second page:

MWE

As you see, "PCR" was added automatically. So it works. The generated source code, should be:

%% LyX 2.3.3 created this file.  For more info, see http://www.lyx.org/.
%% Do not edit unless you really know what you are doing.
\documentclass[english]{article}
\usepackage{fontspec}
\usepackage{makeidx}
\makeindex

\makeatletter %%%%%%%%%%%%%%%%%%%%%%%%%%%%%% User specified LaTeX commands. \usepackage{xesearch} \SearchList{index}{#1\index{{#1}}}{ELISA,PCR}

\makeatother

\usepackage{polyglossia} \setdefaultlanguage[variant=american]{english} \begin{document} \index{ELISA} and PCR

\StopList {index}

\printindex \end{document}

Fran
  • 80,769