7

I'm sure I'm not the first own to ask this question. Sadly, I wasn't able to find an answer just using the search function (probabely I'm using the wrong vocabulary).

The story: I want to write a report. This report will be grouped into three parts. The report will comprise eleven project descriptions.

Since I use the \section command for groups, an example of the structure of this report would be:

\section{Intro}
project 1
project 2


\section{Main}
project 3
...
project 10

\section{Conclusion}
project 11

My challenge: I would like to use a command called \project which looks and works like the \subsection command but numbering each project consecutively, i.e. without taking into account the section it is in.

I image something like this:

\section{Intro}
\project{How to put an egg into hot water}
\project{How to set a timer}


\section{Main}
\project{How to take an egg out of boiling water}
...
\project{How to open a boiled egg}

\section{Conclusion}
\project{How to eat a boiled egg}
1
  • 1
    Welcome to TeX.SE! Which document class do you use (or intend to use)? – Mico Jan 4 '15 at 20:45
8

This can also be done loading the chngcntr package and simply issuing

\counterwithout{subsection}{section}

MWE

\documentclass{article}

\usepackage{chngcntr}

\counterwithout{subsection}{section}
\let\project\subsection

\begin{document}
\tableofcontents

\section{Intro}
\project{How to put an egg into hot water}
\project{How to set a timer}


\section{Main}
\project{How to take an egg out of boiling water}
...
\project{How to open a boiled egg}

\section{Conclusion}
\project{How to eat a boiled egg}
\end{document} 

Output

enter image description here

I would also suggest to format the "projects" so to have the word "Project" behind them.

This can be done with the help of the titlesec and titletoc packages and through these definitions:

\titlecontents{subsection}[3.8em]
{\hspace*{-2.3em}Project\ }
{\hspace*{2.3em}\contentslabel{2.3em}}
{}
{\titlerule*[.75pc]{.}\contentspage}

\titleformat{\subsection}{\normalfont\large\bfseries}{Project\ \thesubsection}{1em}{}
\titlespacing*{\subsection}{0pt}{3.25ex plus 1ex minus .2ex}{1.5ex plus .2ex}

MWE

\documentclass{article}

\usepackage{chngcntr}

\usepackage{titlesec,titletoc}

\titlecontents{subsection}[3.8em]
{\hspace*{-2.3em}Project\ }
{\hspace*{2.3em}\contentslabel{2.3em}}
{}
{\titlerule*[.75pc]{.}\contentspage}

\titleformat{\subsection}{\normalfont\large\bfseries}{Project\ \thesubsection}{1em}{}
\titlespacing*{\subsection}{0pt}{3.25ex plus 1ex minus .2ex}{1.5ex plus .2ex}

\counterwithout{subsection}{section}
\let\project\subsection

\begin{document}
\tableofcontents

\section{Intro}
\project{How to put an egg into hot water}
\project{How to set a timer}


\section{Main}
\project{How to take an egg out of boiling water}
...
\project{How to open a boiled egg}

\section{Conclusion}
\project{How to eat a boiled egg}
\end{document} 

Output

enter image description here

7

Package remreset allows the removal of a counter from the reset list of the parent counter. \thesubsection can then be redefined to exclude the section number. Then \project is just \subsection.

The example also redefines \thesection to have a different numbering scheme for sections.

\documentclass{article}

\usepackage{remreset}
\makeatletter
\@removefromreset{subsection}{section}
\makeatother
\renewcommand*{\thesubsection}{\arabic{subsection}}
\let\project\subsection
\renewcommand*{\thesection}{\Alph{section}}

\begin{document}
\tableofcontents

\section{Intro}
\project{How to put an egg into hot water}
\project{How to set a timer}


\section{Main}
\project{How to take an egg out of boiling water}
...
\project{How to open a boiled egg}

\section{Conclusion}
\project{How to eat a boiled egg}
\end{document}

Result

1
  • chngcntr is much easier than remreset – egreg Jan 4 '15 at 21:25

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.