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

Komaclasses such as scrbook do not define \sf anymore #92

Closed
kiryph opened this issue Mar 22, 2017 · 3 comments
Closed

Komaclasses such as scrbook do not define \sf anymore #92

kiryph opened this issue Mar 22, 2017 · 3 comments

Comments

@kiryph
Copy link

kiryph commented Mar 22, 2017

When using latexdiff for a file which uses as documentclass scrbook the compilation fails with following error:

Class scrbook Error: undefined old font command '\sf'.

This can be fixed when adding following to the preamble

\makeatletter
\DeclareOldFontCommand{\rm}{\normalfont\rmfamily}{\mathrm}
\DeclareOldFontCommand{\sf}{\normalfont\sffamily}{\mathsf}
\DeclareOldFontCommand{\tt}{\normalfont\ttfamily}{\mathtt}
\DeclareOldFontCommand{\bf}{\normalfont\bfseries}{\mathbf}
\DeclareOldFontCommand{\it}{\normalfont\itshape}{\mathit}
\DeclareOldFontCommand{\sl}{\normalfont\slshape}{\@nomath\sl}
\DeclareOldFontCommand{\sc}{\normalfont\scshape}{\@nomath\sc}
\makeatother

However, these style of commands are discouraged to use (see e.g.l2tabuen.pdf) and I also do not like to add code just for diffing latex files.

Can latexdiff itself be changed to handle these classes out-of-the-box?

@ftilmann
Copy link
Owner

ftilmann commented Mar 22, 2017

Are you using -t CFONT option? The default markup style does not use \sf command. You can easily define your own markup commands by using --preamble option (start with show--preamble and simply add the command defining \sf from your post) . I cannot simply replace \sf by \sffamily because the same command needs to work both in text and math mode. I guess there is an argument for adding the line \DeclareOldFontCommand{\sf}{\normalfont\sffamily}{\mathsf}. I will probably do this. I don't think you need the \makeatletter and \makeatother commands.

@kiryph
Copy link
Author

kiryph commented Mar 22, 2017

Yes, I was using CFONT. Since only \sf is missed by latexdiff, only \DeclareOldFontCommand{\sf}{\normalfont\sffamily}{\mathsf} has to be added.

Anyhow, I am no expert and can't judge about side-effects. However, supporting the komaclasses as they stand seems to be a good reason. This would definitely make latexdiff more newbie friendly.

I can imagine how difficult it is to maintain a tool such as latexdiff in an always changing latex world.
For instance, in order to use lualatex and a major mode with changebars following things have to be adjusted: pdftex driver has to be enabled manually for the package changebars and the package luatex85 must be loaded.

ftilmann added a commit that referenced this issue Mar 27, 2017
@ftilmann
Copy link
Owner

There does not seem to be any disadvantage to using \DeclareOldFontCommand so I added that to all the styles using \sf or \bf font commands, and will close this issue. For your comment on luatex please open a separate issue if required. In fact you can implement this your self even without knowing perl by introducing a new type. The preamble for the different markup types are defined near the end of latexdiff, and you could simply add one for luatex+changebar. If you do so please consider submitting a pull request.

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