4

I want to include line numbers(lineno) in an enumeration of paragraphs. How do I avoid line numbers in front of each paragraph header? What I need is something like

\newcommand{\myParagraph}[1]{\nolinenumbers \paragraph{#1} \linenumbers}

which of course does not work. Consider a minimal such that

\documentclass[10pt]{extarticle}
\usepackage[utf8]{inputenc}
\usepackage{lineno, blindtext}
\title{Some title}
\author{Author\footnote{some Institution}}
\date{some Date}

\begin{document}

\maketitle
\linenumbers

\paragraph{Abstract\newline\indent} %%No line number here
\blindtext                          %%line numbers

\end{document}

Does anyone know how to define such command in LaTeX?

1 Answer 1

4

The following definition of \myParagraph should work:

enter image description here

\documentclass[10pt]{extarticle}
\usepackage[utf8]{inputenc}
\usepackage{lineno, blindtext}

\title{Some title}
\author{Author\footnote{some Institution}}
\date{some Date}

\newcommand{\myParagraph}[1]{%
  \par\nolinenumbers
  \paragraph{#1}\mbox{}
  \par\nobreak
  \linenumbers}

\begin{document}

\maketitle

\myParagraph{Abstract} % No line number here

\blindtext             % Line numbers

\myParagraph{Introduction} % No line number here

\blindtext                 % Line numbers

\end{document}

However, if you're not using the paragraph titles in something like a ToC, you might just as well set them using

\newcommand{\myParagraph}[1]{%
  \par\nolinenumbers
  \noindent\textbf{#1}%
  \par\noindent
  \linenumbers}
1
  • Dear Werner, thanks for your solution! It works for me
    – Jenne
    Jul 3, 2019 at 9:57

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .