1

I am trying to add a colon after item number in enumerated list but this produces an error.

Here is my normal MWE:

\documentclass[a4paper]{article} 
\usepackage[utf8]{inputenc}%
\usepackage[T1]{fontenc}%
\newenvironment{xenumerate}%
{\begin{enumerate}\renewcommand\labelenumi{§\theenumi}}%
{\end{enumerate}}%
\begin{document} 
\begin{xenumerate}
\item first
\item second
\end{xenumerate} 
\end{document}

Works like a charm. When I add colon after it it produces different errors:

\documentclass[a4paper]{article} 
\usepackage[utf8]{inputenc}%
\usepackage[T1]{fontenc}%
\newenvironment{xenumerate}%
{\begin{enumerate}\renewcommand\labelenumi{§\theenumi\colon}}%
{\end{enumerate}}%
\begin{document} 
\begin{xenumerate}
\item first
\item second
\end{xenumerate} 
\end{document}

Anyone has an idea how I solve this but without using packages like enumerate and enumitem because they clash with some other things I have?

2
  • 1
    Why not use something like \renewcommand\labelenumi{§\theenumi:}}?
    – leandriis
    Feb 22 '18 at 11:08
  • So simple! If you post this as answer I will accept it. I am also interested in why \colon is not working
    – eklisiarh
    Feb 22 '18 at 11:22
3

The following MWE should give you the desired result. You can sinply use : instead of \colon which is a 'punctuation colon' in math mode and therefor does not work in text mode.

\documentclass[a4paper]{article} 
\usepackage[utf8]{inputenc}%
\usepackage[T1]{fontenc}%
\newenvironment{xenumerate}%
{\begin{enumerate}\renewcommand\labelenumi{§\theenumi:}}%
{\end{enumerate}}%
\begin{document} 
\begin{xenumerate}
\item first
\item second
\end{xenumerate} 
\end{document}

enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.