2

I have looked around and found no answer to this question. I am using the changes package, and I need to remove all markup from the source file. There's this question about using the delcmdchanges.bash, but sadly it goes unanswered.

My questions are these: why is the script not working, and is there a way to make it work ? Is there another script ? (hopefully one that can be used on a windows machine as well)

Some background - I am using a lubuntu 16.04 machine.

I am trying to remove the markup from the following file to no avail:

\documentclass{article}

\usepackage{changes} %I could use [final] to hide the markup from the PDF, but I need the ``evidence'' removed from the source

\begin{document}
 Some text \added{some added text}, and some \replaced{replaced}{replactd} text. \deleted{also, some deleted.}
\end{document}

I placed the script in the same folder as input.tex, made the script executable and used

sh ./delcmdchanges.bash -i input.tex output.tex

I get no error, no query as to found markup, and the output file contents is identical to the input.

  • For windows I suggest cygwin (as a general rule, but it would do the trick here too) – Chris H Nov 14 '16 at 14:36
  • That's a shell for running bash in windows environment, I meant whether there was something more general like a python script – Elad Den Nov 14 '16 at 15:22
  • The heavy lifting is done by awk. You could install that on windows but you'd still need to wrap the calls to awk in a batch file. But seriously if you're used to *nix, being able to run proper shell scripts on windows is a feature worth having – Chris H Nov 14 '16 at 15:33
2

Try the command

awk -W version

It probably tells you something like mawk 1.3.3. mawk is a particular implementation of awk, which in this version has the bug (missing feature?) that it does not support Posix character classes. The script delcmdchanges.bash uses the character class [:space:], which is not interpreted correctly.

Your options are:

  • Upgrade to mawk 1.3.4. Though available since quite some time, it didn't yet make it into several Linux distributions (like Ubuntu 16.04 and 16.10 as well as all current (=Nov 2016) Debian releases, including sid).

  • Install another implementation of awk, like gawk. If it is not automatically made the default after installation (meaning that awk now invokes gawk), replace awk by gawk in the script.

  • Alternatively, edit the script and replace all occurrences of

    [[:space:]]
    

    by

    [ \t\r\n\v\f]
    

    (the backslashes are to be taken literally, so a string of 11 characters is replaced by a string of 13 characters).

| improve this answer | |
  • The second alternative worked very well, thank you. I tried the third first and it did not work. I did not fancy the first as the repository version is 1.3.3. Thank you very much for your help ! – Elad Den Nov 14 '16 at 17:40
  • @EladDen Can you check whether you have really replaced all 19 occurrences of [[:space:]] by [ \t\r\n\v\f] (note that the second character of the second string is a space character), with the replacement string amounting to 13 characters? I have tested it on Ubuntu 16.04 and 16.10, and it works in both cases. – gernot Nov 14 '16 at 19:07
  • I might have made a mistake copying the new string. I tried it again, (also replacing awk with mawk, since I have gawk installed now) and it seemed to have worked. – Elad Den Nov 14 '16 at 19:59

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.