7

With the following MWE:

\documentclass{article}
% \usepackage[utf8]{inputenc}
\usepackage{easylist}

\begin{document}
\begin{easylist}[enumerate]
  § A first item
      §§ A sub item
      §§ another subitem    
\end{easylist}
\end{document}

We get the desired output:

enter image description here

But if the line \usepackage[utf8]{inputenc} is uncommented, we'd then get:

enter image description here

While this can be fixed by either (a) using XeLaTeX, or (b) \usepackage[at]{easylist} and @ instead of §, is there a way to make § markers work with \usepackage[utf8]{inputenc} in pdfLaTeX?

4
  • 3
    Short answer: no. The easylist marker must be a single character, but in UTF-8 § is two byte long: blind alley.
    – egreg
    Jan 25, 2017 at 8:17
  • thanks @egreg , can you add that as an answer?
    – imnothere
    Jan 25, 2017 at 8:47
  • @egreg this can't be the reason: § is two bytes in utf8 regardless if you load inputenc or not. The difference is that its first byte is active. Jan 25, 2017 at 8:49
  • @UlrikeFischer That was a “short answer”: try with \usepackage[T1]{fontenc} and you'll see what happens.
    – egreg
    Jan 25, 2017 at 9:16

1 Answer 1

2

You can use the following hack that changes the unicode character § to be an easylist item inside the easylist environment:

\documentclass{article}

\usepackage[utf8]{inputenc}
\usepackage{easylist}

\DeclareUnicodeCharacter{00A7}{\easylistitemornot}
\let\easylistitemornot\S

\def\easylist{%
  \def\easylistitemornot{\futurelet\elNextToken\elCreateItem}%
  \begingroup\elPredefinedStyle}%
\def\endeasylist{\endgroup\par}
\def\Activate{%
  \def\easylistitemornot{\futurelet\elNextToken\elCreateItem}%
}
\def\Deactivate{%
  \let\easylistitemornot\S
}

\begin{document}
\begin{easylist}[enumerate]
  § A first item
      §§ A sub item
      §§ another subitem    
\end{easylist}

Here we have a real §.
\end{document}

Nevertheless I would recommend to use, e.g., option at to change the item marker:

\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage[at]{easylist}

\begin{document}
\begin{easylist}[enumerate]
  @ A first item
      @@ A sub item
      @@ another subitem    
\end{easylist}
\end{document}
1
  • thanks, works great! agree that using at and @ is much cleaner, but was just wondering if it's possible.
    – imnothere
    Jan 26, 2017 at 0:58

You must log in to answer this question.

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