GeneralSwitch-off for \addtocounter - command for subsubsection

LaTeX specific issues not fitting into one of the other forums of this category.
Post Reply
Montag
Posts: 340
Joined: Wed Jul 15, 2009 9:25 am

Switch-off for \addtocounter - command for subsubsection

Post by Montag »

Hello,

I'd like to nullify the command

Code: Select all

\addtocounter{subsubsection}{1}
in line 34 of the attached MWE.
I'd only like this particular command to be nullified. Is that possible?

I am asking because the command

Code: Select all

\addtocounter{subsection}{1}
in line 41 has to work, meaning I can't just nullify

Code: Select all

\addtocounter
.
Attachments
comment-subsubsection-test.tex
(764 Bytes) Downloaded 246 times
Last edited by Montag on Wed Mar 16, 2011 11:33 am, edited 1 time in total.
OS: Win 7 64-bit LaTeX: MikTeX 2.9 64-bit Editor: TXC 1 RC1

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

5gon12eder
Posts: 126
Joined: Sun Feb 13, 2011 8:36 pm

Switch-off for \addtocounter - command for subsubsection

Post by 5gon12eder »

This sounds quite weired to me. Could you tell us why you would like to do that? I'm almost certain there is a more straight forward solution for what you would like to achieve.
I'm using pdfTeX, Version 3.1415926-1.40.10 (TeX Live 2009/Debian).
Montag
Posts: 340
Joined: Wed Jul 15, 2009 9:25 am

Re: Switch-off for \addtocounter - command for subsubsection

Post by Montag »

I use the comment-environment to filter all the unnecessary content for a summary of lecture notes I am writing at the moment.

My "old-school" method was to go back into the document and mark all the irrelevant lines and then mark them as comments (using the per cent sign) via CTRL+Q (I'm using TXC). But that's a prime example of a method that takes too much time and is sort of pointless considering it's possible to achieve the whole thing ... in the beginning, when one is writing it up.

So when the comment-environment is enabled, all the counters for subsection etc. are of course changed. I guess the best way then would be to manually turn off automatic numbering put chapter/section/... numbers in front of chapter/section/... headings ...?
OS: Win 7 64-bit LaTeX: MikTeX 2.9 64-bit Editor: TXC 1 RC1
Montag
Posts: 340
Joined: Wed Jul 15, 2009 9:25 am

Switch-off for \addtocounter - command for subsubsection

Post by Montag »

Montag wrote:I guess the best way then would be to manually turn off automatic numbering put chapter/section/... numbers in front of chapter/section/... headings ...?
To stay consistent with the notes provided by the faculty, this really is the best way to avoid boring edits later on.

edit:
This topic can be regarded als "solved".
Last edited by Montag on Thu Mar 17, 2011 9:28 am, edited 1 time in total.
OS: Win 7 64-bit LaTeX: MikTeX 2.9 64-bit Editor: TXC 1 RC1
5gon12eder
Posts: 126
Joined: Sun Feb 13, 2011 8:36 pm

Switch-off for \addtocounter - command for subsubsection

Post by 5gon12eder »

Maybe not the best but an imho reasonable solution:

Code: Select all

\documentclass{article}
\usepackage[T1]{fontenc}
\usepackage{ifthen}

\newboolean{shortened}

\setboolean{shortened}{true}     % short version
% \setboolean{shortened}{false}  % full version

\begin{document}
  \section{First Section}
  This section will always be visible.

  \ifthenelse{\boolean{shortened}}{\stepcounter{section}}
  {
    \section{Second Section}
    This section will only be visible if the `shortened' is set false.

    \subsection{Subsection to Second Section}
    Some more stuff.
  }

  \section{Third Section}
  This section will always be visible and will always have the number 3.
\end{document}
What do you think of that? You may wish to put each (sub)section into its own ifthenelse block so you can randomly add / (re)move sections without having to care about their number.

Best
I'm using pdfTeX, Version 3.1415926-1.40.10 (TeX Live 2009/Debian).
Montag
Posts: 340
Joined: Wed Jul 15, 2009 9:25 am

Re: Switch-off for \addtocounter - command for subsubsection

Post by Montag »

Thank you very much for your effot, but this is more work than the method to manually enumerate everything. This is why I made my previous post and marked the topic as "solved".
OS: Win 7 64-bit LaTeX: MikTeX 2.9 64-bit Editor: TXC 1 RC1
Post Reply