3

I am writing my Masterthesis with Latex (lualatex). For the actual writing part I like to use showframe option of the geometry package. This helps me to find overfull hboxes.

Today I wondered if I could also include paragraph, tab and spacing characters (and maybe some others) into my PDF file for better visibility.

I am talking about something like the option in Microsoft Word where you can show your spaces etc.

enter image description here

I have searched google but did not find anything (may I only used the wrong words ;) ).

So can I have some similar functionality in Latex and include those characters automatically into my PDF file?

I am using Sumatra PDF for viewing the PDF file. Maybe there is an option to enable this?

Thanks in advance!

Sorkfa
  • 133

2 Answers2

3

I can delete this if it is not what is being asked, but here is an approach with tokcycle:

\documentclass{article}
\usepackage{tokcycle}
\Macrodirective{\tctestifx{\par#1}{\addcytoks{\P}}{%
  \tctestifx{\space#1}{\addcytoks{\textvisiblespace
  \allowbreak}}{\addcytoks{#1}}}}
\Spacedirective{\addcytoks{\textvisiblespace\allowbreak}}
\begin{document}
\tokencyclexpress
\section{This is my section title}

Now here is my text.

A new paragraph.Even math [ y = mx + b ]

Oops, a double line skip and then a double* space not seen because of the way things are absorbed, but this type of one \space*is seen as double \endtokencyclexpress \end{document}

enter image description here

If you wanted to actually have the \par in addition to seeing the \P, that is a trivial change to the macro directive

\Macrodirective{\tctestifx{\par#1}{\addcytoks{\par\P}}{%
  \tctestifx{\space#1}{\addcytoks{\textvisiblespace
  \allowbreak}}{\addcytoks{#1}}}}

enter image description here

I have not addressed tabs, because it is unclear to me whether the OP intends detection of an actual TAB character in the input stream, or whether it refers to visual handling of & tabbing separators.

2

The lua-visual-debug package which was developed for an answer on this site

How can I visualize boxes?

Does something similar to your request.

David Carlisle
  • 757,742