# No indentation after \paragraph command not working

I'm trying to create a new command called \domanda{}, that makes use of the \paragraph{} to create a series of questions with Q: in-built, together with their answers on a new line, WITHOUT indentation. However this is not giving the expected results. Can you help me find a solution? Please refer to the extensive code below.

\documentclass[a4paper, 10pt]{article}

\usepackage[utf8]{inputenc}
\usepackage{lmodern}
\usepackage[T1]{fontenc}

\usepackage[top=2cm, bottom=2cm, left=3cm, right=2cm]{geometry}
\usepackage[italian]{babel}
\usepackage{hyperref}
\hypersetup{pdfstartview=FitH} %fits pdf to width, FitV= fits pdf to hight
\usepackage{amsmath}
\usepackage{amsthm}
\usepackage{amsfonts}
\usepackage{amssymb}
\usepackage{booktabs}
\usepackage{graphicx}
\usepackage{tabularx}
\usepackage{caption}
\usepackage{textcomp}
\usepackage{marvosym}

\newcommand{\domanda}[1]{\paragraph{Q: #1\newline}}
\setlength\parindent{0pt}
...
\begin{document}
\input{somefile.tex}
\end{document}


The new sentence I type after the \paragraph{} start on a new line but WITH indentation.

Please always post complete minimal documents that show the problem. I have removed the packages not relevant here.

\paragraph is a sectioning command, and LaTeX supports two styles of such commands: display and run-in. Run in headings do not invoke the code to suppress paragraph indentation. Placing a forced line break in the heading does not produce the correct effect as you see.

You could redefine \paragraph not to be run-in, but then it would be more or less the same as \subsubsection so I have just used that here:

\documentclass[a5paper, 10pt]{article}

\newcommand{\domanda}[1]{\subsubsection*{Q: #1}}
\setlength\parindent{0pt}

\begin{document}

\domanda{zzz}
a a a a a a a a a a a a a a a a a a a a a a
a a a a a a a a a a a a a a a a a a a a a a
\end{document}


Here's a possible solution:

\documentclass[a4paper, 10pt]{article}

\newcommand{\domanda}[1]{\paragraph{Q: #1}\mbox{}\par\nobreak\noindent\ignorespaces}

\begin{document}

\domanda{A}
test text

\end{document}


• Any thing a little bit simpler? I'm not familiar w/ all those brackets and numbers and symbols... Basically I don't understand why \setlength\parindent{0pt} doesn't work ;) – WobblyWindows May 9 '13 at 18:39
• @WobbyWindows please see my updated answer. – Gonzalo Medina May 9 '13 at 18:43