1

Easier to show than explain. This creates a new section type and counter. Note that \section definitions are found in and depend on the document class. \documentclass{article} \newcounter{code} \makeatletter \newcommand\code{\@startsection {code}{1}{\z@}% must use same name as counter {-3.5ex \@plus -1ex \@minus -.2ex}% ...


1

[H] assumes it comes between paragraphs. You shouldn't really ever need \newline or \noindent in a document, I would add \usepackage{parskip} so paragraph indention is zero and just use blank lines instead of \newline.


Only top voted, non community-wiki answers of a minimum length are eligible