Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I would like to create a new command based on subsection behavior.

Requirements are as follows:

  • make a \newcommand
  • support for alternative labels
  • add \vspace{-.2in} after the label

The reason for making this is that I would not like to change the default behavior for existing / other subsections.

share|improve this question

1 Answer 1

You just need to copy the definition of subsection from your class (I'm assuming article here) and make the changes you want.

\newcounter {subsection}[section]

It has a counter, reset every section.

\renewcommand\thesubsection   {\thesection.\@arabic\c@subsection}

The section counter prefixes this counter when displayed

\newcommand\subsection{\@startsection{subsection}{2}{\z@}%
                                     {-3.25ex\@plus -1ex \@minus -.2ex}%
                                     {1.5ex \@plus .2ex}%
                                     {\normalfont\large\bfseries}}

The fonts and spacing used for the heading

\newcommand\appendix{\par
  \setcounter{section}{0}%
  \setcounter{subsection}{0}%
  \gdef\thesection{\@Alph\c@section}}

It's reset in the appendix

\newcommand*\l@subsection{\@dottedtocline{2}{1.5em}{2.3em}}

Uses a dotted line format in the table of contents

share|improve this answer
    
either i'm not awake yet, or this has the same name(s) as the existing subsection, which the op said s/he didn't want to be changed. ??? –  barbara beeton Mar 5 '13 at 12:47
    
@barbarabeeton you missed out the make the changes you want bit. the above is as you say exactly a copy of subsection from article as the OP gave no indication of what changes are required –  David Carlisle Mar 5 '13 at 12:52

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.