6

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{}:

\message{.}\message{.}\message{.}
\bye

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

2 Answers 2

3

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

\def\mymessage#1{\directlua{texio.write("\luaescapestring{#1}")}}
\mymessage{.}\mymessage{.}\mymessage{.}
\bye

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.
1
  • Thanks, @Sharpie. Using Lua would indeed be a solution here.
    – AlexG
    Commented May 9, 2011 at 7:25
6

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;
end

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.

2
  • 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
    Commented May 9, 2011 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. Commented May 9, 2011 at 13:51

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .