I need to render an ASCII file for printing in a way that removes ambiguity if (very unlikely) one decides to type it in and validate the signatures.

I am giving the 8-bit symbol-set QR code as an alternative, but a manual validation would be a nice addition for archival purposes.

Essentially, I need a monospace typesetter that would typeset a 'blank space' symbol for space, a CR/LF symbol (and proceed to the next line for readability) whenever a CR/LF is encountered, etc., making it obvious if there are any trailing whitespaces before the CR/LF, if there is a character present, etc.

Is there a font that accomplishes that goal? *nix utility? TeX module/package/derived system? I've posted a similar question on TeX.SE, but it might be better suited here.


On a unix/linux system, you can pipe the file through tr, converting certain characters to others. For example:

cat file.txt | tr ' \n' '#$'

will translate all spaces to # and all newlines to $.

If you need to transform CR/LF together, you can use tr ' ' '#' to change spaces, and pipe output into another tr -t '\r\n' '$' to change the newlines. The -t tells tr to truncate the matched set to the length of the replacement set.

You could also use the utility dos2unix to first translate all the \r\n line endings to the more unix \n, then use the first option.

Example (with \n only):

$ echo "foo bar" | tr ' \n' '#$'

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.