1

I am writing a parser for warnings. I have extended the width of LaTeX's output so that errors and warnings all occur on a single line.

However, I have a problem with multi-line, formatted warn warnings as these are more difficult to handle.

An example is the following:

Package biblatex Warning: Biber reported the following issues
(biblatex)                with 'kannan_random_1997':
(biblatex)                - Datamodel: Entry 'kannan_random_1997' 
(bibliography.bib): Invalid ISSN in value of field 'issn'.

Here I would like to remove the newline, the (biblatex) and the white-space after it so the warning appears on a single line such as the following:

Package biblatex Warning: Biber reported the following issues with 'kannan_random_1997': - Datamodel: Entry 'kannan_random_1997' Invalid ISSN in value of field 'issn'.

Is there a way of cutting down the output like the above, either by using LaTeX or by changing environment variables/parameters?

MWE:

\documentclass{article}
\begin{document}
    \fontfamily{asdf}\selectfont
    Hello, world!
\end{document}
  • 1
    Could you paste a self-contained example document that reproduces the error(s) you want to extract? I presume biblatex errors are not the only ones your want to fetch? – siracusa Oct 19 '18 at 19:53
  • 2
    probably \def\MessageBreak{} but untested as you provide no test code – David Carlisle Oct 19 '18 at 20:01
  • note the latex2e message linebreak specifically puts the package name on each new line so that it's easier to parse these messages and recognise the continuation lines,... – David Carlisle Oct 19 '18 at 20:03
  • @DavidCarlisle \def\MessageBreak{} doesn't seem to be working for me... – The Sign Painter Oct 19 '18 at 20:23
  • ah no you'd have to patch \GenericWarning where it locally defines \messageBreak – David Carlisle Oct 19 '18 at 20:54
3
LaTeX Font Warning: Font shape `OT1/asdf/m/n' undefined using `OT1/cmr/m/n' ins
tead on input line 12.

from

\makeatletter
\DeclareRobustCommand{\GenericWarning}[2]{%
   \begingroup
      \def\MessageBreak{ }%^^J#1}%
      \set@display@protect
      \immediate\write\@unused{^^J#2\on@line.^^J}%
   \endgroup
}
\makeatother
\documentclass{article}
\begin{document}
    \fontfamily{asdf}\selectfont
    Hello, world!
\end{document}

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.