Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bibleref/indextools: undefined control sequence: \indexspace ->idx:item #95

Open
hanetzer opened this issue Nov 24, 2022 · 3 comments
Open

Comments

@hanetzer
Copy link

Got another one for ya.
Per the documentation on bibleref, Sec 3.3,
I've put together this mwe. Compiles fine with lualatex.

% vim: spell spelllang=en ft=tex
\documentclass[14pt,a4paper,english]{memoir}

\usepackage{bibleref}
\usepackage{indextools}

\makeindex[title=List of Scriptures,name=\jobname.scr]
\renewcommand{\biblerefindex}{\index[\jobname.scr]}
\begin{document}

\tableofcontents

\mainmatter

\chapter{Gen}
\ibibleverse{Gen}(1:1)
\ibibleverse{Exo}(1:1)
\printindex[\jobname]

\end{document}

Attempting to build with tex4ebook errors out on the index, with the error mentioned above,
but does eventually produce an epub file.
However, I must manually hit 'q' to continue the build at this point three times.

@michal-h21
Copy link
Owner

Thanks for the report. The main issue here is that indextools are not supported by TeX4ht. There are several issues:

  • the \index command must write some additional info to the .idx file
  • the theindex environenment must not be redefined
  • the automatic index generation needs to be suppressed

It should be fixed using this file, indextools.4ht:

\def\:tempa[#1]#2{\html:addr%
\hbox{\Link-{}{dx\last:haddr
}\EndLink}%
%\@wrindex\:indexfile
\expandafter\protected@write\csname#1@idxfile\endcsname{}%\:indexfile{}%
{\string\beforeentry{\RefFileNumber\FileNumber}{dx\last:haddr
}{\a:makeindex}}%
\o:@index:[#1]{#2}%
}
\HLet\@index\:tempa%

\ifx \a:makeindex\:UnDef
\NewConfigure{makeindex}{1}\Configure{makeindex}{}
\fi
\Configure{@begin}{theindex}{\ind:defs}

% disable redefiniton of \theindex in \AtBeginDocument
\indtl@originaltrue

% prevent automatic compilation of the index
\let\KV@indtl@noautomaticfalse\KV@indtl@noautomatictrue
\KV@indtl@noautomatictrue
\indtl@disableautomatictrue


\Hinput{indextools}
\endinput

With this file, you shouldn't get errors. Then, you need to compile the index yourself, using this build file, build.lua:

if mode == "draft" then
  Make:htlatex{}
else
  Make:htlatex{}
  Make:xindex {idxfile="sample.scr.idx"}
  -- Make:xindex {}
  Make:htlatex{}
end

Unfortunately, I've found an error in the indexing script, so you will need also this file from make4ht.

With these changes, it should be possible to run:

$ tex4ebook -e build.lua -lf epub3 sample.tex

@hanetzer
Copy link
Author

hanetzer commented Dec 5, 2022

sorry for the delay in response, but the above works. regarding the make4ht file replacement, will that make its way upstream or is it a specific fix for my particular situation?

@michal-h21
Copy link
Owner

The indextools.4ht file is already included in TeX Live, so you shouldn't need it. You need just the build file.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants