7

As a package author, I want people to load my package with a version parameter like

\usepackage[version=4]{mhchem}

I decided to use a warning (and no error) if they did not, because not specifying a version works for basic usage and the differences will only be noticed on more complex chemical formulae.

I do not mind too much that questions asked here do not contain a version parameter. But the accepted answers should be completely correct, in my point of view. However, almost none of the accepted answers did so, initially.

This leads me to the conclusion that even experienced LaTeX users that post answers here, do not take a look at the LaTeX warnings, rendering the warning system of LaTeX virtually useless.

So before I consider changing my warning into an error, I wanted to ask here if there was the possibility to create more obvious warnings. (I doubt it, but I wanted to ask anyway.)

Update

Maybe you could report back how your editor behaves.

\documentclass{article}
\usepackage{expl3}
\begin{document}
a
\PackageWarning{test}{This is a traditional warning.}
\ExplSyntaxOn
\msg_new:nnn { test } { msg } { This~is~a~LaTeX3~warning.}
\msg_warning:nn { test } { msg }
\end{document}
  • TeXworks: Identifies traditional warning, but not LaTeX3 warning. Nevertheless hides console output after compilation, even if a warning was identified.
  • ...
mhchem
  • 3,485
  • 12
  • 37
  • 'More obvious' in what way? Most users use an (La)TeX editor rather than the command line, and most of those hide the log/terminal to a greater or lesser extent ... – Joseph Wright Feb 06 '16 at 17:10
  • Most obvious would really be to issue an error, like ledmac currently does. This will really draw attention. On the other hand, if using an older version is fine, why change? – Johannes_B Feb 06 '16 at 17:16
  • 3
    Ugly solution: Write a warning in the document.Somethig like This formula is generated with an old mhchem version So it is visible in the generated document. But if you do so, please accept also a final-option to supress the output. – knut Feb 06 '16 at 17:27
  • @JosephWright 'More obvious' in the way that users will see it. One idea could be: Use the traditional \PackageWarning, because the LaTeX3 warnings are not recognized by the majority of editors, yet? – mhchem Feb 06 '16 at 18:04
  • TeXstudio reads only the traditional warning but both types of errors (\PackageError and \msg_error:nn); see this screen shot. – Tobi Feb 06 '16 at 18:45
  • @Tobi have you ever asked latex to write the file name before the error msg (to make it easier to read for humans), then texmaker can longer parse the errors #notimpressed – daleif Feb 06 '16 at 19:11
  • Look at the issue with novice eyes: The warnings are a pain and if the result looks good ...what on earth I should look at a cryptic log file? On the other side, convert warnings into errors is just convert a "good" result into a problem. Not funny at all. For myself I use sometimes the knut's ugly solution in some macro, but only to not overlook obvious mistakes that anyone (excepting the author) can detect easily . Otherwise, for me is enough a human readable warning in the log file. – Fran Feb 06 '16 at 20:19
  • @daleif: Sorry … I don’t understand, what you mean … O:-) – Tobi Feb 06 '16 at 22:03
  • @Tobi Say you have a multi file doc and there is an error in chap3.tex line 6. Usually the log will say there is an error in line 6 and you'll need to look around to find out which file has the problem (look for ./chap3.tex). TeXLive has a setting that prefixes all errors with the name of the file in which the error occurred. If you enable that feature, texmaker can no longer parse the log file (emacs+auctex has no issues with it as far as I remember) – daleif Feb 06 '16 at 22:15
  • @daleif: I’m not using texmaker but TeXstudio which is able to tell me the file. Actually I never thought about this issue before.See this screen shot. Hope this comment helps ;-) – Tobi Feb 06 '16 at 22:28
  • @Tobi texmaker can also report the file as long as that feature is not enabled. It was just an example of how problematic/fragile the relying on editors being able to parse and report the log, actually is – daleif Feb 06 '16 at 22:31
  • @daleif: Ah ok … but the OP asked about the behavior of the editors ;-) All I wanted to do is to tell about TeXstudios features … – Tobi Feb 06 '16 at 22:49
  • @Tobi it would be interesting to know if texstudio could handle that feature being enabled. – daleif Feb 06 '16 at 23:01
  • 1
    Why can't you make one version the default? It sounds curious that you force users to add it. – Ulrike Fischer Feb 06 '16 at 23:35
  • @UlrikeFischer The newest version is the default. However, I want to warn users: "If you update your TeX installation and get a new major mhchem version, some complex formula might render differently. This could be an issue if you have a large document like a thesis with a large number of formulae. So you better specify the version, so that I, the author, can take care not to change a single minus sign in the whole of your thesis." – mhchem Feb 07 '16 at 07:39
  • @daleif: If you explain how I can enable/disable that feature I could test it. But I never set something up to make TeXstudio work with multiple files. – Tobi Feb 07 '16 at 14:57
  • @Tobi I'll have to look it up (not at a pc at the moment). Multiple file docs are just where you include parts of the doc using \input or \include – daleif Feb 07 '16 at 15:53
  • @Tobi I have file_line_error_style = t in texlive/2015/texmf.cnf – daleif Feb 09 '16 at 08:29

2 Answers2

1

Thanks to your reports, my suspicion was confirmed.

If a package author wants users to see a warning, he/she should use the traditional warning (\PackageWarning), because LaTeX3 warnings (\msg_warning:nn) are not identified by a lot of LaTeX editors.

mhchem
  • 3,485
  • 12
  • 37
  • I think some feature requests are in order :-) Please see also http://latex-community.org/forum/viewtopic.php?f=36&t=25617 – Johannes_B Feb 07 '16 at 09:01
0

Kile identifies the traditional warning in the Log and Messages tab, but not the expl3 one. However, the complete output is available in the Output tab.

On the other hand, Kile in its current state can't find its own .cwl files, so I don't hold out much hope of its identifying expl3 syntax or warnings.

cfr
  • 198,882