scribble Latex: make numbered subsections work in an unnumbered section

original commit: ab21e387f2b4f6be8a0381df2578c706819495e9
This commit is contained in:
Matthew Flatt 2013-07-27 10:29:33 -06:00
parent c2616f298c
commit 491181b202
8 changed files with 321 additions and 5 deletions

View File

@ -382,7 +382,7 @@ The recognized @tech{style properties} are as follows:
@item{@racket['grouper] --- The part is numbered with a Roman
numeral, and its subsections continue numbering as if they
appeared in the preceeding part. In other works, the part acts
appeared in the preceeding part. In other words, the part acts
like a ``part'' in a book where chapter numbering is continuous
across parts.}

View File

@ -185,18 +185,21 @@
% Useful for some styles, such as sigalternate:
\newcommand{\SNumberOfAuthors}[1]{}
\let\SOriginalthesubsection\thesubsection
\let\SOriginalthesubsubsection\thesubsubsection
% sections
\newcommand{\Spart}[2]{\part[#1]{#2}}
\newcommand{\Ssection}[2]{\section[#1]{#2}}
\newcommand{\Ssubsection}[2]{\subsection[#1]{#2}}
\newcommand{\Ssection}[2]{\section[#1]{#2}\let\thesubsection\SOriginalthesubsection}
\newcommand{\Ssubsection}[2]{\subsection[#1]{#2}\let\thesubsubsection\SOriginalthesubsubsection}
\newcommand{\Ssubsubsection}[2]{\subsubsection[#1]{#2}}
\newcommand{\Ssubsubsubsection}[2]{{\bf #2}}
\newcommand{\Ssubsubsubsubsection}[2]{\Ssubsubsubsection{#1}{#2}}
% "star" means unnumbered and not in ToC:
\newcommand{\Spartstar}[1]{\part*{#1}}
\newcommand{\Ssectionstar}[1]{\section*{#1}}
\newcommand{\Ssubsectionstar}[1]{\subsection*{#1}}
\newcommand{\Ssectionstar}[1]{\section*{#1}\renewcommand*\thesubsection{\arabic{subsection}}\setcounter{subsection}{0}}
\newcommand{\Ssubsectionstar}[1]{\subsection*{#1}\renewcommand*\thesubsubsection{\arabic{section}.\arabic{subsubsection}}\setcounter{subsubsection}{0}}
\newcommand{\Ssubsubsectionstar}[1]{\subsubsection*{#1}}
\newcommand{\Ssubsubsubsectionstar}[1]{{\bf #1}}
\newcommand{\Ssubsubsubsubsectionstar}[1]{\Ssubsubsubsectionstar{#1}}
@ -223,6 +226,11 @@
\newcommand{\Ssubsubsubsectiongrouperstar}[1]{\Ssubsubsubsectionstar{#1}}
\newcommand{\Ssubsubsubsubsectiongrouperstar}[1]{\Ssubsubsubsubsectionstar{#1}}
\newcommand{\Ssubsectiongrouperstarx}[2]{\setcounter{GrouperTemp}{\value{subsection}}\Ssubsectionstarx{#1}{#2}\setcounter{subsection}{\value{GrouperTemp}}}
\newcommand{\Ssubsubsectiongrouperstarx}[2]{\setcounter{GrouperTemp}{\value{subsubsection}}\Ssubsubsectionstarx{#1}{#2}\setcounter{subsubsection}{\value{GrouperTemp}}}
\newcommand{\Ssubsubsubsectiongrouperstarx}[2]{\Ssubsubsubsectionstarx{#1}{#2}}
\newcommand{\Ssubsubsubsubsectiongrouperstarx}[2]{\Ssubsubsubsubsectionstarx{#1}{#2}}
% Generated by `subsubsub*section':
\newcommand{\SSubSubSubSection}[1]{\Ssubsubsubsubsectionstar{#1}}

View File

@ -0,0 +1,36 @@
#lang scribble/base
@title[#:tag "top"]{Title}
@section[#:tag "1" #:style 'grouper]{Section One}
This is @secref["1"] in @secref["top"].
See @secref["2"] and @secref["2.1"].
See @secref["3"], @secref["3.1"], @secref["3.2"], @secref["3.2.1"], and
@secref["3.3"].
@section[#:tag "2" #:style 'grouper]{Section Two}
@subsection[#:tag "2.1"]{Section Two.One}
[content a]
@section[#:style '(grouper unnumbered) #:tag "3"]{Section Three}
@subsection[#:tag "3.1"]{Section Three.One}
[content b]
@subsection[#:tag "3.2"]{Section Three.Two}
@subsubsection[#:tag "3.2.1"]{Section Three.Two.One}
[content c]
@subsection[#:tag "3.3" #:style 'unnumbered]{Section Three.Three}
[content d]

View File

@ -0,0 +1,32 @@
Title
I. Section One
This is Section One in Title.
See Section Two and Section Two.One.
See Section Three, Section Three.One, Section Three.Two, Section
Three.Two.One, and Section Three.Three.
II. Section Two
1. Section Two.One
[content a]
Section Three
2. Section Three.One
[content b]
3. Section Three.Two
3.1. Section Three.Two.One
[content c]
Section Three.Three
[content d]

View File

@ -0,0 +1,55 @@
#lang scribble/base
@title[#:tag "top"]{Title}
@table-of-contents[]
@section[#:tag "1"]{Section One}
This is @secref["1"] in @secref["top"].
See @secref["2"] and @secref["2.1"].
See @secref["3"], @secref["3.1"], @secref["3.1.1"], @secref["3.2"],
@secref["3.2.1"], and @secref["3.3"].
See @secref["4"].
See @secref["5"] and @secref["5.1"].
@section[#:tag "2"]{Section Two}
@subsection[#:tag "2.1"]{Section Two.One}
[content a]
@section[#:style '(unnumbered) #:tag "3"]{Section Three}
@subsection[#:tag "3.1" #:style 'grouper]{Section Three.One}
@subsubsection[#:tag "3.1.1"]{Section Three.One.One}
[content b]
@subsection[#:tag "3.2" #:style 'grouper]{Section Three.Two}
@subsubsection[#:tag "3.2.1"]{Section Three.Two.One}
[content c]
@subsection[#:tag "3.3" #:style '(unnumbered grouper)]{Section Three.Three}
[content d]
@section[#:style '(unnumbered) #:tag "4"]{Section Four}
[content e]
@section[#:tag "5"]{Section Five}
@subsection[#:tag "5.1"]{Section Five.One}
[content f]

View File

@ -0,0 +1,65 @@
Title
    1 Section One
    2 Section Two
      2.1 Section Two.One
    Section Three
      I Section Three.One
        1 Section Three.One.One
      II Section Three.Two
        2 Section Three.Two.One
      Section Three.Three
    Section Four
    3 Section Five
      3.1 Section Five.One
1. Section One
This is Section One in Title.
See Section Two and Section Two.One.
See Section Three, Section Three.One, Section Three.One.One, Section
Three.Two, Section Three.Two.One, and Section Three.Three.
See Section Four.
See Section Five and Section Five.One.
2. Section Two
2.1. Section Two.One
[content a]
Section Three
I. Section Three.One
1. Section Three.One.One
[content b]
II. Section Three.Two
2. Section Three.Two.One
[content c]
Section Three.Three
[content d]
Section Four
[content e]
3. Section Five
3.1. Section Five.One
[content f]

View File

@ -0,0 +1,55 @@
#lang scribble/base
@title[#:tag "top"]{Title}
@table-of-contents[]
@section[#:tag "1"]{Section One}
This is @secref["1"] in @secref["top"].
See @secref["2"] and @secref["2.1"].
See @secref["3"], @secref["3.1"], @secref["3.1.1"], @secref["3.2"],
@secref["3.2.1"], and @secref["3.3"].
See @secref["4"].
See @secref["5"] and @secref["5.1"].
@section[#:tag "2"]{Section Two}
@subsection[#:tag "2.1"]{Section Two.One}
[content a]
@section[#:tag "3"]{Section Three}
@subsection[#:tag "3.1" #:style 'grouper]{Section Three.One}
@subsubsection[#:tag "3.1.1"]{Section Three.One.One}
[content b]
@subsection[#:tag "3.2" #:style 'grouper]{Section Three.Two}
@subsubsection[#:tag "3.2.1"]{Section Three.Two.One}
[content c]
@subsection[#:tag "3.3" #:style '(unnumbered grouper)]{Section Three.Three}
[content d]
@section[#:style '(unnumbered) #:tag "4"]{Section Four}
[content e]
@section[#:tag "5"]{Section Five}
@subsection[#:tag "5.1"]{Section Five.One}
[content f]

View File

@ -0,0 +1,65 @@
Title
    1 Section One
    2 Section Two
      2.1 Section Two.One
    3 Section Three
      3.I Section Three.One
        3.1 Section Three.One.One
      3.II Section Three.Two
        3.2 Section Three.Two.One
      Section Three.Three
    Section Four
    4 Section Five
      4.1 Section Five.One
1. Section One
This is Section One in Title.
See Section Two and Section Two.One.
See Section Three, Section Three.One, Section Three.One.One, Section
Three.Two, Section Three.Two.One, and Section Three.Three.
See Section Four.
See Section Five and Section Five.One.
2. Section Two
2.1. Section Two.One
[content a]
3. Section Three
3.I. Section Three.One
3.1. Section Three.One.One
[content b]
3.II. Section Three.Two
3.2. Section Three.Two.One
[content c]
Section Three.Three
[content d]
Section Four
[content e]
4. Section Five
4.1. Section Five.One
[content f]