Single space after inline code?

by Pejman Poh   Last Updated January 06, 2018 16:23 PM

I'm writing a bunch of inline code like so:

\documentclass[a4paper,12pt]{report}

% New Commands
\newcommand{\code}[1]{\texttt{#1}} % Create new \code blocks
\newcommand{\malloc}{\code{malloc()}}
\newcommand{\flp}{\code{\_\_flp}}

\begin{document}

Another important variable used in \malloc is \flp.

\end{document}

However what gets produced: Screenshot of result

There is no space after malloc(). I could fix this by appending a \space to the end of the newcommand but then __flp would mess up. How do I get \texttt to stop ignoring spaces after it's command.

I tried switching to \listings but whatever configs I had set up didn't fix the issue. I am not averse to switching back however.

Tags : spacing code


Related Questions


No space between characters under \texttt{} command

Updated February 15, 2018 01:23 AM


Equals signs merging together in lstlisting

Updated June 25, 2018 21:23 PM


How to make this syntax tree not overlapping?

Updated May 02, 2017 01:23 AM