Skip to content

Conversation

urshofer
Copy link
Contributor

I've implemented makeindex. It works for my needs. There are two options, see the readme file. Since I'm using makeindex in a german environment, I use the -g option. It can be omitted or made optional.

urshofer and others added 7 commits September 29, 2017 08:13
added option args, falling back to default if not passed.
prevent child process from stalling
options.makeindex and options.indexStyle
@saadq
Copy link
Owner

saadq commented Dec 14, 2017

Hey @urshofer, thanks a lot for this PR! This is interesting and would probably be a cool feature to add. Would you be able to share a small example of a .tex file that you would use makeindex with so that I can test it out?

Also, currently I wouldn't be able to accept this PR due to the usage of spawnSync and writeFileSync. Ideally, I want to keep everything async. Changing writeFileSync to writeFile would be easy enough, but I imagine the reason you chose to use spawnSync was because you wanted to wait for makeindex to complete before moving on. However, I think this could just be replicated by listening to the .on('close', () => { ... }) of the child process.

I'd be very happy to work together on this with you if you wouldn't mind sharing an example so that I can test it out a bit. Let me know if you have any questions/comments on it! :)

@saadq saadq added the feature label Dec 15, 2017
@urshofer
Copy link
Contributor Author

Hi Saad

you're right - spawnSync is not elegant but indeed the passes have to wait for makeindex to complete.
Since it's an optional feature it's easier to integrate the sync way, I'm just skipping spawnSync if the option is disabled:

if (indexCmd !== false) {
  let _indexResult = spawnSync(indexCmd, indexArgs, indexOpts)
}

Using callbacks would result in a litte bit more and duplicate code, and nested async calls are sometimes hard to read.
But it would be easy to rewrite it according to your needs.

Urs

PS: I'm quite busy right now but this would be kind of a minimal example:

\documentclass[english]{article}
\usepackage[T1]{fontenc}
\usepackage[latin9]{inputenc}
\usepackage{makeidx}
\makeindex
\usepackage{babel}
\begin{document}
This is an index\index{index}
\printindex{}
\end{document}

This should result in something like this:

bildschirmfoto 2017-12-15 um 13 02 06

@saadq
Copy link
Owner

saadq commented Dec 19, 2017

Sorry for the delay, I've been a bit busy! I'll be able to check this out within a few days, and I'll let you know if I have any feedback. Thanks for the example!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants