Skip to content

Escape inline verbatim spaces in LaTeX output (\texttt) #1694

@bjornbm

Description

@bjornbm

Currently e.g. f . g is rendered to LaTeX as \texttt{f . g}. LaTeX in turn will treat the . as a regular sentence ending period and substitutes an em/quad(?) for the following space. Furthermore, multiple spaces in inline verbatim blocks are also discarded by LaTeX:

`f    . g`

becomes

\texttt{f    . g}

I would argue that neither of these are ever the desired behavior for verbatim text.

The solution appear to be to escape all spaces within the backticks, giving \texttt{f\ .\ g} and \texttt{f\ \ \ \ .\ g} for the above examples. This leaves automatic line breaking “intact”, where all \ at the break are replaced by a single line break. I think is reasonable behaviour for inline verbatim text.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions