Is there a way to insert a backspace character while writing to the terminal? I'd like to remove the space character that is automatically inserted between two calls of \message{}:


is written as . . . to the terminal but I want ....


The texio library provided by luatex provides more control over message formatting and does not insert a space:


The result is:

grendel:io sharpie$ luatex io.tex
This is LuaTeX, Version beta-0.60.2-2010071218 (TeX Live 2010) (rev 3736) 
(./io.tex... )
No pages of output.
  • Thanks, @Sharpie. Using Lua would indeed be a solution here. – AlexG May 9 '11 at 7:25

This space is, as far as I know, impossible to avoid between two separate \messages. The solution would be to first combine all the contiguous material in one macro (adding material with \edef\foo{\foo <material>}), and then doing \message{\foo}.

To really know where the space comes from, look in tex.web, documented source code of TeX. The relevant procedure seems to be procedure issue_message;, which calls @<Print string |s| on the terminal@>, defined as follows.

@ @<Print string |s| on the terminal@>=
begin if term_offset+length(s)>max_print_line-2 then print_ln
else if (term_offset>0)or(file_offset>0) then print_char(" ");
slow_print(s); update_terminal;

I think that print_char(" ") is the culprit. A related question on \write rather than \message was answered by @TH. last January, and he introduced me to reading tex.web.

  • Thank you for your explanations. Collecting the material before printing it eventually is not a solution in my case because I want to output dots as a progress indicator while reading chunks of larger binary files. – AlexG May 9 '11 at 7:20
  • @Alexander Grahn: that's a good reason then. I was wondering why anyone would really need that, since the precise log mostly doesn't matter. – Bruno Le Floch May 9 '11 at 13:51

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.