I am typesetting exercises with the exercise package. I want to have my custom exercise header, my custom answer header as well as the exercise and answer body all left aligned. It works well for the answer environment, but not really for the exercise part.

\documentclass[a4paper]{article}
\usepackage{exercise}
\usepackage[utf8]{inputenc}
\usepackage[german]{babel}
\usepackage{amsmath}
\usepackage{amsthm}
\usepackage{amsfonts}
\usepackage{amssymb}
\usepackage[left=2cm,right=2.5cm,top=2.5cm,bottom=2cm]{geometry}
\numberwithin{equation}{Exercise}

}\smallskip\newline}

\setlength{\ExerciseSkipBefore}{0\baselineskip}

\begin{document}

\begin{Exercise}[label = wdsw, title = Widerstandswürfel , difficulty =      2]
Gegeben ist ein Würfel, wobei jede der Kanten einen Widerstand von $R = 1~\mathrm{\Omega}$ hat.\\
Wie groß ist der Widerstand entlang einer Raumdiagonale?
\end{Exercise}
Wir wollen den Widerstand zwischen den Punkten $X$ und $Y$ bestimmen,   also entlang der Raumdiagonale (siehe Abb. \ref{fig:wdsws1}). Weil die Raumdiagonale eine Symmetrieachse ist, sollte das Problem symmetrisch sein, und deswegen eine recht einfache Lösung haben.\\


There are two parts to this answer:

• After redefining the macros \ExerciseHeader and \AnswerHeader, the indentation of the the headlines equals the usual indentation of the text. You can set this to zero with:

\setlength\parindent{0pt}

• In the code of the exercise package, there is a hard-coded \hspace{.66em} at the start of the Exercise body. To neutralize it, you can redefine \AtBeginExercise:

\renewcommand{\AtBeginExercise}{\hspace{-0.66em}}


So your full header section on the style of the Exercise and Answer could look like this:

\setlength\parindent{0pt}

\renewcommand{\DifficultyMarker}{}
\renewcommand{\ExerciseName}{Aufgabe}

\renewcommand{\AtBeginExercise}{\hspace{-0.66em}}



Update: You might be right, there is still too much space before the exercise title, and I'm not one hundred percent sure about the space in front of the exercise body. So with changing "Aufgabe" to "Hausaufgabe" and "Gegeben ist ein Würfel" to "Es ist ein Würfel gegeben" (to have straigth lines at the left to compare indentation more easily), I find this configuration satisfying to my eye:

\setlength\parindent{0pt}

\renewcommand{\DifficultyMarker}{}
\renewcommand{\ExerciseName}{Hausaufgabe}

• You can of course play with the definition of \AtBeginExercise. I first had it at -7pt, maybe that is a good starting point for you. Similarly, you could define a \AtBeginExerciseHeader, insert it at the beginning of the redefinition of \ExerciseHeader and start trying like -1pt there. Just change in small steps until you (and the cangaroo ;) ) are satisfied. May 15, 2017 at 10:46