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

--remove-macros doesn't always work #205

Closed
RemDelaporteMathurin opened this issue Jun 24, 2022 · 1 comment
Closed

--remove-macros doesn't always work #205

RemDelaporteMathurin opened this issue Jun 24, 2022 · 1 comment
Labels
wontfix This will not be worked on

Comments

@RemDelaporteMathurin
Copy link

RemDelaporteMathurin commented Jun 24, 2022

Hi @sylvainhalle thanks for that great tool!

I would like to use remove-macros on the siunitx package commands (\SI and \si) because textidote rules sh:d:002 and sh:d:003 shouldn't apply here.

Here's my MWE:

\documentclass{article}
\usepackage[english]{babel}
\usepackage{siunitx}

\begin{document}

\title{My Paper}
\maketitle

My units are units as \SI{1.7e16}{m^{-2}.s^{-1}}.

My other units are \SI{1.2e4}{m^2.s^{-1}}
\end{document}

I run the following command on the latest release v0.8.2:

java -jar textidote.jar --remove-macros SI --output html main.tex > report.html

The SI macro should be ignored right?

Here's the result:
image

Here's the command-line output:

TeXtidote v0.8.2 - A linter for LaTeX documents and others
(C) 2018-2021 Sylvain Hallé - All rights reserved

Found 2 warning(s)
Total analysis time: 0 second(s)

←[1;33m* L10C22-L10C45←[0m←[39m←[49m There should be a space after a period. If you are writing a
  URL or a filename, use the \url{} or \verb markup. ←[2;33m[sh:d:002] ←[0m←[39m←[49m
←[1;37m  My units are units as \SI{1.7e16}{m^{-2}.s^{-1}}.
                       ←[1;31m^^^^^^^^^^^^^^^^^^^^^^^^←[0m←[39m←[49m
←[1;33m* L10C22-L10C43←[0m←[39m←[49m There should not be a space before the period at the end of a
  sentence. ←[2;33m[sh:d:003] ←[0m←[39m←[49m
←[1;37m  My units are units as \SI{1.7e16}{m^{-2}.s^{-1}}.
                       ←[1;31m^^^^^^^^^^^^^^^^^^^^^^←[0m←[39m←[49m

Is this a bug?

@sylvainhalle sylvainhalle added the wontfix This will not be worked on label Jun 24, 2022
@sylvainhalle
Copy link
Owner

It is a "bug" or a "feature", depending on how you see it. ;-)

There are two issues here:

  1. The \SI macro takes two arguments: \SI{foo}{bar}. TeXtidote has no way of knowing how many arguments are defined for a macro, and only removes the first, leaving {bar}.
  2. Arguments contain nested pairs of curly brackets: \SI{foo{baz}}{b{a}r}. TeXidote cannot process sequences of TeX code that require finding matching brackets.

Which explains why the cleaned version of the text still contains parts of your macro call, resulting in the error message.

Fixing the issue would be a case of #56, so unfortunately I have to mark this (actual) bug as #wontfix.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
wontfix This will not be worked on
Projects
None yet
Development

No branches or pull requests

2 participants