# \noindent inside a command not working

i looked a lot for a solution to my problem but i don´t seem to be able to find one. Here is the summary:

in my document I have a custom command for a description and i would like this description to NOT have an indentation.

The document is

documentclass{article}
\usepackage[document]{ragged2e}
\usepackage{graphicx}
\usepackage{wrapfig, framed, caption}
\usepackage{hyperref}
\usepackage[utf8]{inputenc}
\usepackage[nochapters]{classicthesis}
\usepackage[LabelsAligned]{currvita}

\newcommand{\MarginText}[1]{\marginpar{\color{royalblue}\itshape\small#1}}
\newlength{\datebox}\settowidth{\datebox}{11/2017x-x09/2018}

\newcommand{\NewEntry}[3]{\noindent\hangindent=2em\hangafter=0\noindent\parbox[t]{\datebox}{\small #1} {\small \textbf{#2}}

\newcommand{\Description}[1]{\hangindent=2em\hangafter=0\noindent\raggedright\small {#1}\noindent\par\normalsize\vspace{1em}}

\begin{document}

\NewEntry{10/2018-Present}{Corrector of Discrete Mathematics, \textsc{University Ulm}}
\Description{\MarginText{ SK Mathematik} Algebraic structures, Elementary Number Theory, Finite bodies, Foundations of Coding Theory.  \ \ $\cdotp$\ \ }

\end{document}

and the result is

Is there any way to get rid of this space between "Algebraic" and "Foundation"?

Any help is appreciated!

• Welcome to TeX.SX! I think the problem is the space right after { SK Mathematik }, not the paragraph indentation. Removing it should fix the problem. If not, please add a minimal but complete document to your question that replicates the output – siracusa Nov 4 '18 at 19:41
• Sadly it did not solve it. I updated the extract with more Information. – Luca Zangari Nov 4 '18 at 20:01

The problem has nothing to do with your code: it was due to the space you left between \margintext{...} and `Algebraic:

\documentclass[twoside, svgnames]{article}%
\usepackage{showframe}
\renewcommand{\ShowFrameLinethickness}{0.3pt}
\usepackage{xcolor}
\newcommand{\Description}[1]{\hangindent=2em\hangafter=0\noindent\raggedright\small#1\noindent\par\normalsize\vspace{1em}}
\newcommand{\MarginText}[1]{\marginpar{\color{RoyalBlue}\itshape\small#1}}

\begin{document}

\Description{\MarginText{ SK Mathematik }%
Algebraic structures, Elementary Number Theory, Finite bodies, Foundations of Coding Theory.}

Some more text

Some more text

\end{document}

• Thank you so much. Another pair of eyes telling me a very basic oversight was exactly what i needed. – Luca Zangari Nov 4 '18 at 20:10
• The % is only needed because of the mis-use of \noindent in the definition prematurely starting the paragraph, so space is not ignored. – David Carlisle Nov 4 '18 at 21:39

The \noindent in \Descritiption forces the paragraph to start too early so the space after the \marginpar is set in hmode so visible rather than being ignored.

You can delete them, but unfortunately a \marginpar in vertical mode comes on the line above the paragraph, so it is simplest to use \noindent before the \marginpar, and then \ignorespaces to ignore any spaces following.

re-using Bernard's example as the one in the question produces no output.

\documentclass[twoside, svgnames]{article}%
\usepackage{showframe}
\renewcommand{\ShowFrameLinethickness}{0.3pt}
\usepackage{xcolor}
\newcommand{\Description}[1]{\hangindent=2em\hangafter=0 \raggedright\small#1\par\normalsize\vspace{1em}}
\newcommand{\MarginText}[1]{\small\noindent\marginpar{\color{RoyalBlue}\itshape#1}\ignorespaces}

\begin{document}

\Description{\MarginText{ SK Mathematik }
Algebraic structures, Elementary Number Theory, Finite bodies, Foundations of Coding Theory.}

Some more text

Some more text

\end{document}