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

undetected missing algorithmx package when compiling komatufte #4

Open
espinielli opened this issue Aug 21, 2019 · 5 comments
Open

Comments

@espinielli
Copy link

This is to signal that the TeX Live mechanism to automagically install missing packages fails in the case of algorithms feature as for the komatufte vignette.
Here is the error from the log file:

...
LaTeX Warning: Reference `alg:algorithm' on page 2 undefined on input line 527.



! LaTeX Error: Environment algorithm undefined.

See the LaTeX manual or LaTeX Companion for explanation.
Type  H <return>  for immediate help.
 ...                                              
                                                  
l.529 \begin{algorithm}
...

I am on a MS Windows machine and all missing fonts/styles got installed but algorithmicx.
I suppose this is due to the fact that line 340 in the komatufte.tex template (\usepackage[noend]{algpseudocode})

% Algorithms
\IfFileExists{algpseudocode.sty}{%
\usepackage[noend]{algpseudocode}
...

will trigger TeX Live to search for algpseudocode.sty in CTAN and fail to discover it.
Once I manually installed algorithmicx, everything worked.

The following change makes the automatic installation and pdf production work magically again (tested by removing algorithmicx + failing PDF without the change + adding the change + success):

% Algorithms
\usepackage{algorithmicx}
\IfFileExists{algpseudocode.sty}{%
\usepackage[noend]{algpseudocode}
...

I am not sure this is a valid implementation...but it can make life easier for potential users...
HTH

@jolars
Copy link
Owner

jolars commented Aug 24, 2019

The problem with this solution, however, is that the package will simply fail when algorithmicx is not available.

@espinielli
Copy link
Author

Shouldn't it then be installed automatically?
I tested it with TinyTeX and all happens automatically...

@espinielli
Copy link
Author

espinielli commented Aug 24, 2019

FYI I have been playing with another approach (search for scrbook in bookdown's book) not really needing an R package.
I have a (for now private) repo with a template for a scrbook-based book.

@jolars
Copy link
Owner

jolars commented Aug 24, 2019

In any case I think using IfFileExists is good practice and some people will not need the algorithm functionality. Have you tried putting \usepackage{algorithmicx} after IfFileExists?

@espinielli
Copy link
Author

Yes I tried and it failed because algpseudocode.sty is part of algorithmicx package (see CTAN).

When algoritmicx is not installed algpseudocode.sty is not found as a standalone .sty file by tlmgr when trying to (automagically) install it.

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