5

I use the exercises package to create exercises inside a script file but in my \listofexercises there is a t at the beginning of every entry, which I couldn't find any explanation for. How do I fix this?

I tried differnt languages via babel, but the problem remains the same.
Here is my code:

\documentclass[11pt, oneside]{scrartcl}
\usepackage[utf8]{inputenc}
\usepackage[ngerman]{babel}
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{amssymb}
\usepackage{makeidx}
\usepackage{graphicx}
\usepackage{lmodern}
\usepackage{kpfonts}
\usepackage[]{geometry}
\usepackage{lipsum}
\usepackage{xcolor}
\usepackage{framed}
\usepackage{exercise}

\begin{document} \tableofcontents \listofexercises \section{Lipsum} \lipsum[1] \begin{framed} \begin{Exercise}[ title={Integration 1}, difficulty=0, origin=myself, label=aufg1] Integrieren Sie folgende Funktion: [\left(\sin (x)+\cos(x)\right)^{e^{-x}}] \end{Exercise} \end{framed} \lipsum[1] \end{document}

pmaen
  • 83

1 Answers1

8

The package exercise has two \expandafter commands in the wrong place; they're actually wrong and must be removed.

There's a telltale warning you get:

LaTeX Font Warning: Font shape `T1/jkp/m/i' undefined
(Font)              using `T1/jkp/m/n' instead on input line 1.

which stems from the line in the loe file

\contentsline {exercise}{{\"U}bung\ 1\ {\relax \fontshape it\selectfont Integration 1}\hspace {.66em}}{1}{}%

Obviously \fontshape it is wrong and is produced by the wrong \expandafter we'll remove.

\documentclass[11pt, oneside]{scrartcl}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage[ngerman]{babel}
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{amssymb}
\usepackage{makeidx}
\usepackage{graphicx}
\usepackage{lmodern}
\usepackage{kpfonts}
\usepackage[]{geometry}
\usepackage{lipsum}
\usepackage{xcolor}
\usepackage{framed}
\usepackage{exercise}

\usepackage{etoolbox}

\makeatletter % remove the faulty \expandafter \patchcmd{@@@ExeEnv} {\theExercise\ \expandafter} {\theExercise\ } {}{} \patchcmd{@@@ExeCmd} {\theExercise\ \expandafter} {\theExercise\ } {}{} \makeatother

\begin{document} \tableofcontents \listofexercises \section{Lipsum} \lipsum[1] \begin{framed} \begin{Exercise}[ title={Integration 1}, difficulty=0, origin=myself, label=aufg1] Integrieren Sie folgende Funktion: [\left(\sin (x)+\cos(x)\right)^{e^{-x}}] \end{Exercise} \end{framed} \lipsum[1] \end{document}

I added \usepackage[T1]{fontenc} that's really necessary for typesetting in German.

Now the loe file will have the right incantation:

\contentsline {exercise}{{\"U}bung\ 1\ {\itshape Integration 1}\hspace {.66em}}{1}{}%

enter image description here

If you also want to remove \itshape, do a second series of patches.

\documentclass[11pt, oneside]{scrartcl}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage[ngerman]{babel}
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{amssymb}
\usepackage{makeidx}
\usepackage{graphicx}
\usepackage{lmodern}
\usepackage{kpfonts}
\usepackage[]{geometry}
\usepackage{lipsum}
\usepackage{xcolor}
\usepackage{framed}
\usepackage{exercise}

\usepackage{etoolbox}

\makeatletter % remove the faulty \expandafter \patchcmd{@@@ExeEnv} {\theExercise\ \expandafter} {\theExercise\ } {}{} \patchcmd{@@@ExeCmd} {\theExercise\ \expandafter} {\theExercise\ } {}{} % remove \itshape \patchcmd{@@@ExeEnv} {\itshape} {} {}{} \patchcmd{@@@ExeCmd} {\itshape} {} {}{} \makeatother

\begin{document} \tableofcontents \listofexercises \section{Lipsum} \lipsum[1] \begin{framed} \begin{Exercise}[ title={Integration 1}, difficulty=0, origin=myself, label=aufg1] Integrieren Sie folgende Funktion: [\left(\sin (x)+\cos(x)\right)^{e^{-x}}] \end{Exercise} \end{framed} \lipsum[1] \end{document}

enter image description here

egreg
  • 1,121,712