summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/ncclatex/nccheadings.sty
blob: c97e7deb60c65ff1e0c84d4501f52cc742b14a23 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{nccheadings}
         [2005/12/28 v1.00 Headings in ncc-style (NCC)]
%
% \changes{v1.00}{2005/12/28}{This version is uploaded to CTAN}
%
% NCC page style with headings support
%
\def\NCC@setpsheading{%
  \let\@oddfoot\@empty\let\@evenfoot\@empty
  \def\@evenhead{%
    \thepage\hfil
    {\small\itshape\ignorespaces\leftmark\unskip}\hfil
  }%
  \def\@oddhead{%
    \hfil{\small\itshape\ignorespaces\rightmark\unskip}\hfil
    \thepage
  }%
  \reset@font
}
\def\NCC@firstmark#1{\markboth{#1}{#1}}
\def\NCC@secondmark#1{\markright{#1}}
%
% Specify `headings' and `myheadings' page styles
%
\@ifundefined{chapter}{%
%
% Styles for article-like classes
%
  \def\ps@headings{\NCC@setpsheading
    \def\partmark##1{%
      \NCC@firstmark{\ifnum \c@secnumdepth>\m@ne\thepart.\enskip \fi
        \ignorespaces##1}}%
    \def\sectionmark##1{%
      \NCC@firstmark{\ifnum \c@secnumdepth>\z@\thesection.\enskip \fi
        \ignorespaces##1}}%
    \def\subsectionmark##1{%
      \NCC@secondmark{\ifnum\c@secnumdepth>\@ne\thesubsection.\enskip\fi
        \ignorespaces##1}}%
  }  
  \def\ps@myheadings{\NCC@setpsheading
    \let\partmark      \@gobble
    \let\sectionmark   \@gobble
    \let\subsectionmark\@gobble
  }
  \ps@myheadings
}{%
%
% Styles for book-like classes
%
  \@ifundefined{if@mainmatter}{%
    \newif\if@mainmatter \@mainmattertrue
  }
  \def\ps@headings{\NCC@setpsheading
    \def\partmark##1{%
      \NCC@firstmark{\ifnum \c@secnumdepth>-2\relax
          \partname\ \thepart.\enskip \fi
        \ignorespaces##1}}%
    \def\chaptermark##1{%
      \NCC@firstmark{\ifnum \c@secnumdepth>\m@ne
           \if@mainmatter \@chapapp\ \thechapter.\enskip \fi \fi
         \ignorespaces##1}}%
    \def\sectionmark##1{%
      \NCC@secondmark{\ifnum\c@secnumdepth>\z@\thesection.\enskip\fi
        \ignorespaces##1}}%
  }  
  \def\ps@myheadings{\NCC@setpsheading
    \let\partmark   \@gobble
    \let\chaptermark\@gobble
    \let\sectionmark\@gobble
  }
  \ps@headings
}
\endinput