[comp.text.tex] need LaTeX macros for section and subsection numbering

jiang@hbar.rice.edu (Jun Jiang) (06/15/90)

Well, I need to write an article with LaTeX in the following format:

I. Section 1
................
...some text ...
................

A. Subsection 1 of I
................
...some text ...
................

B. Subsection 2 of I
................
...some text ...
................

II. Section 2
................
...some text ...
................


The tricky thing here is the dot "." after each section number such as
I. A., etc.  I could redefine the \thesection and \thesubsection
command to append a ".", but when I use \ref{sec:xxx}, I also get a
dot after the section numbers.  This looks strange in the middle of a
sentence.  

Does anyone outthere have a quick solution for this problem???

jwe@ut-emx.UUCP (John W. Eaton) (06/15/90)

In article <JIANG.90Jun14154352@hbar.rice.edu> jiang@hbar.rice.edu
(Jun Jiang) writes:
:
: Well, I need to write an article with LaTeX in the following format:
:
: I. Section 1
: ...some text ...
:
: The tricky thing here is the dot "." after each section number such
: as I. A., etc.  I could redefine the \thesection and \thesubsection
: command to append a ".", but when I use \ref{sec:xxx}, I also get a
: dot after the section numbers.
:
: Does anyone outthere have a quick solution for this problem???

The quickest slickest thing I can think of (-:

Steal the sectioning macros from jeep.sty.  They allow you to easily
define your own defaults for section numbering.  If your site doesn't
have jeep.sty, you can get it and some handy documentation (jeep.tex)
via anonymous ftp or mail server from the Clarkson archive
(sun.soe.clarkson.edu).

John Eaton
jwe@emx.utexas.edu
Department of Chemical Engineering
The University of Texas at Austin
Austin, Texas  78712


-- 
John Eaton
jwe@emx.utexas.edu
Department of Chemical Engineering
The University of Texas at Austin
Austin, Texas  78712

yxoc@sbsvax.cs.uni-sb.de (Ralf Treinen) (06/15/90)

In article <JIANG.90Jun14154352@hbar.rice.edu>, jiang@hbar.rice.edu (Jun Jiang) writes:
> 
> The tricky thing here is the dot "." after each section number such as
> I. A., etc.  I could redefine the \thesection and \thesubsection
> command to append a ".", but when I use \ref{sec:xxx}, I also get a
> dot after the section numbers.  This looks strange in the middle of a
> sentence.  
> 

Try the following. It changes the generic command for section headings
such that a dot is printed after the section number.
Use it as a documentstyle, or enclose it in "\makeatletter" and "\makeatother".

% Change \@sect from latex.tex.
% A dot will be printed after the counter in the section heading.
% The toc - and aux entries will not be affected.
% Ralf Treinen (yxoc@cs.uni-sb.de)
\def\@sect#1#2#3#4#5#6[#7]#8{\ifnum #2>\c@secnumdepth
     \def\@svsec{}\else 
     \refstepcounter{#1}\edef\@svsec{\csname the#1\endcsname.\hskip 1em }\fi
     \@tempskipa #5\relax
      \ifdim \@tempskipa>\z@ 
        \begingroup #6\relax
          \@hangfrom{\hskip #3\relax\@svsec}{\interlinepenalty \@M #8\par}
        \endgroup
       \csname #1mark\endcsname{#7}\addcontentsline
         {toc}{#1}{\ifnum #2>\c@secnumdepth \else
                      \protect\numberline{\csname the#1\endcsname}\fi
                    #7}\else
        \def\@svsechd{#6\hskip #3\@svsec #8\csname #1mark\endcsname
                      {#7}\addcontentsline
                           {toc}{#1}{\ifnum #2>\c@secnumdepth \else
                             \protect\numberline{\csname the#1\endcsname}\fi
                       #7}}\fi
     \@xsect{#5}}
-- 
 Ralf Treinen                         | Universitaet des Saarlandes          
 FB 14 - Informatik (Dept. of CS)     | D-6600 Saarbruecken 11, West Germany 
--------------------------------------+--------------------------------------
 email: treinen@cs.uni-sb.de          | phone: +49 681 302 2065