In my .tex document I use sans-serif font with \sffamily. (And I don't want this to be monospace!)
For my algpseudocode I tried using \texttt. (For I want using a serif monospace font.)
Please take a look at this minimal example
\documentclass[a4paper,10pt,english]{scrartcl}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage[english]{babel}
\usepackage[a4paper,margin=2.5cm,footskip=0.5cm]{geometry}
\usepackage{algpseudocode}
\title{Example Document}
\begin{document}
\sffamily
\section{some content}
So, that's what my written content looks like. Sans-serif. Pretty nice, eh?
\texttt %When I remove this line, no error at all!
\begin{algorithmic}
\State x = 0
\While{x < 10}
\State x = x+1
\EndWhile
\end{algorithmic}
\sffamily
But for some reason, this doesn't work.
\end{document}
I always keep those errors:
monospace-algorithm.tex:19: Paragraph ended before \text@command was complete. []
monospace-algorithm.tex:19: Too many }'s. []
- What is
\text@command? I counted the
}and the{. Their number seems correct.Where do those come from?
- How to make the pseudocode monospace? (I prefer to use standard commands like
\sffamilyinstead of fonts.)

\sffamily, which is a switch and affects all text in the group after it,\textttis a macro that usually only applies to its argument:\texttt{foo} bar. In the example\textttdoes not have an argument and that might be problematic. You could go with the switch\ttfamilyinstead. But I'm quite sure there is a more elegant solution that does not require using all those font commands manually in the document. – moewe Sep 18 '18 at 05:41\usepackage{lmodern}where the bold is not very pronounced or look at https://tex.stackexchange.com/q/215482/35864 – moewe Sep 18 '18 at 05:51