2

I have this kind of homeworks here and I want to get things aligned nicely like "1.2.6 EX. ... a) ... b) ..", "` -- how? I don't like that LaTex inserts immediately the point 8 and points 8.1/8.2 etc.

enter image description here

enter image description here

Minimal working example

\documentclass{article}
\usepackage[english]{babel}
\usepackage{graphicx}
\usepackage{float}

\begin{document}
\tableofcontents
\newpage

\section{Exercise 1.1.1} 
\section{Exercise 1.3.4}
\subsection{a) The equation for the affine variety}
\end{document}
3
  • 1
    Could you provide a minimal working example starting with \documentclass and ending with \end{document}? This would help a lot in answering you. :) Commented Sep 20, 2012 at 7:02
  • Without an MWE it is hard to tell. Are you using \section for the exercise? If so you can use \section*{1.2.6 Exercise} instead and \subsection*{a) Drawing}
    – Guido
    Commented Sep 20, 2012 at 7:06
  • @Guido I tried with "*" but it removes the subsection -name from the Table of Contents, I would like to have it there.
    – hhh
    Commented Sep 20, 2012 at 7:08

2 Answers 2

6

You can use

\newcommand{\exercise}[1]{\section*{#1 Exercise}\addcontentsline{toc}{section}{#1 Exercise}}
\newcommand{\working}[1]{\subsection*{#1}\addcontentsline{toc}{subsection}{#1}}

and then use

\exercise{1.1.1}
\working{a) Drawing}
...

\exercise{1.1.2}
\working{a) Drawing}
...

EDIT Modified to avoid to type Exercise in the argument.

Example what it becomes

enter image description here

1
  • Without retyping the word Exercise each time, is it possible to just have \exercise{1.3.4}? Instead of \exercise{1.3.4 Exercise}?
    – hhh
    Commented Sep 20, 2012 at 7:26
0

You may have a look on the following code and its output:

\documentclass{report}
\usepackage[english]{babel}
\usepackage{graphicx}
\usepackage{float}

\renewcommand\thesection{\arabic{chapter}.\arabic{section}}
\renewcommand\thesubsection{\alph{subsection})}


\begin{document}
\tableofcontents
\newpage
\chapter{Theorem XX}
\section{Exercise A}
\section{Exercise B}
    \subsection{Exercise B.1}
    \subsection{Exercise B.2}
\section{Exercise C}
\section{Exercise D}
\section{Exercise E}

\chapter{Theorem YY}
\section{Exercise F}
    \subsection{The equation for the affine variety}
    \subsection{The equation for the affine variety}
\section{Exercise G}
\section{Exercise H}
\end{document}

Output after running the code: enter image description here

If you still want to try with 1.1.1 Exercise then you need to include \part command in the preamble like "\renewcommand\thesection{\arabic{part}.\arabic{chapter}.\arabic{section}}" and use part command in document body!

You must log in to answer this question.

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