0

I'm writing a macro to write commands to a file. These commands are supposed to be read when building my document.

The lines I use to write to the file is :

\newwrite\outtest
\immediate\openout\outtest=\jobname.ong
\immediate\write\outtest{\unexpanded{\ShowF{#1}{#2}{#3}{#4}{#5}{#6}}\wbgroup\getpagerefnumber{\the\value{line}}\wegroup \writepercent}%

It write things like this in the file jobname.ong :

\ShowF {1}{A}{AB}{ABI}{0}{\Trad {}{}{}{}}{5}%
\ShowF {1}{A}{AB}{ABO}{0}{\Trad {}{}{}{}}{5}%
\ShowF {1}{A}{AB}{ABR}{0}{\Trad {}{}{}{}}{5}%

I also need to use \obeyspaces to be uses in conjonction with a mono font.

For an unknown reason, my document fail to build with \obeyspaces but work fine without. I noticed that when I remove the blank lines in jobname.ong, my document compile fine :

\ShowF{1}{A}{AB}{ABI}{0}{\Trad{}{}{}{}}{5}%
\ShowF{1}{A}{AB}{ABO}{0}{\Trad{}{}{}{}}{5}%
\ShowF{1}{A}{AB}{ABR}{0}{\Trad{}{}{}{}}{5}%

Do you know how to remove blank lines after a command in an output file ?

Do you know why \obeyspaces complain about these spaces ?

4
  • please edit the question so people can run the example and see the issue, it is much harder to debug disconnected fragments. – David Carlisle Nov 7 '18 at 22:10
  • 1
    if \obeyspaces is in force then in \ShowF {1}{ the first argument of \ShowF is the active space not {1} is that your question? – David Carlisle Nov 7 '18 at 22:11
  • 1
    I do not see any blank lines do you mean avoid writing the space? perhaps \immediate\write\outtest{\string\ShowF\unexpanded{{#1}{#2}{#3}{#4}{#5}{#6}}\wbgroup\getpagerefnumber{\the\value{line}}\wegroup \writepercent}% – David Carlisle Nov 7 '18 at 22:14
  • Puting \string before the commands to write solve my problem. Thanks ! – JeanJouX Nov 7 '18 at 22:36
2

I do not see any blank lines do you mean avoid writing the space? perhaps

\immediate\write\outtest{\string\ShowF\unexpanded{{#1}{#2}{#3}{#4}{#5}{#6}}\wbgroup\getpagerefnumber{\the\value{line}}\wegroup \writepercent}% 

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.