2

I am trying to use \message to debug my code; in particular, to print information to the console. For some reason it is not adding line returns after each invocation (see example below). How can I force the line returns in the log (console)? Thanks, Jorge.

Example code:

\message{I:-------------------------------------------------------------------------------}
\message{I: textfloatsep    = \the\floatsep}
\message{I: floatsep        = \the\floatsep}
\message{I:-------------------------------------------------------------------------------}
\show\show

Output in console:

I:------------------------------------------------------------------------------- I: textfloatsep = 12.0pt plus 2.0pt minus 2.0pt
I: floatsep = 12.0pt plus 2.0pt minus 2.0pt I:-------------------------------------------------------------------------------
> \show=\show.
l.73 \show\show

? 

UPDATE: solution using \typeout:

\typeout{I:-------------------------------------------------------------------------------}
\typeout{I: \string\textfloatsep                                \space\space\space\space\space  = \the\textfloatsep}
\typeout{I: \string\floatsep        \space\space\space\space    \space\space\space\space\space  = \the\floatsep}
\typeout{I:-------------------------------------------------------------------------------}
\show\show

OUTPUT:

I:-------------------------------------------------------------------------------
I: \textfloatsep     = 12.0pt plus 2.39996pt minus 2.39996pt
I: \floatsep         = 12.0pt plus 2.0pt minus 2.0pt
I:-------------------------------------------------------------------------------
> \show=\show.
l.73 \show\show

?
dontpanic
  • 809
  • 3
    if you are using latex you can use ^^J or better \MessageBreak – David Carlisle Apr 26 '18 at 20:51
  • That solved it! Thanks again, David! BTW, is it possible to print a backslash within a \message? I can't get it to print e.g. "\textfloatsep = ..." – dontpanic Apr 26 '18 at 20:54
  • 1
    but use \typeout rather than message to make each messag ecome on its own line – David Carlisle Apr 26 '18 at 20:55
  • 1
    \message{\textfloatsep} prints \textfloatsep ??? – David Carlisle Apr 26 '18 at 20:58
  • Sorry, but which mode/syntax are all these commands using/expecting? I also cannot add blank spaces inside the \typeout to align the values printed (as in the example code)... Using "\ \ " does insert the blanks but it also prints the backslashes (I suspect due to the presence of the "\string" earlier in the lines) – dontpanic Apr 26 '18 at 21:05
  • 1
    no \ never makes a space token it is an unexpanable primitive which is why it prints as \ you can use \space to make a space. – David Carlisle Apr 26 '18 at 21:11
  • Got it! All problems solved now. Thanks again for your help! – dontpanic Apr 26 '18 at 21:16

1 Answers1

4

if you are using latex you can use ^^J or better \MessageBreak, but also you can use \typeout to make each message come on its own line (and protect fragile commands)

David Carlisle
  • 757,742