summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/coseoul/coseoul.sty
blob: 0146d229d46e279648846399f0826a6e12fe7af7 (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
\ProvidesPackage{coseoul}
\RequirePackage{ifthen}

\newcommand{\chex}{}

\newcounter{currentlevel}
% part					= 7		chapter				= 6		section				= 5
% subsection		= 4		subsubsection	=	3		paragraph			=	2
% subparagraph	=	1

\ifthenelse{\isundefined{\chapter}}%
	{\renewcommand{\chex}{N}\setcounter{currentlevel}{5}}%
	{\renewcommand{\chex}{Y}\setcounter{currentlevel}{6}}

\newcommand{\findnewlevel}[1]% uppity (-1 down, 0 stay, 1 up, 2-6 multiup
{	\addtocounter{currentlevel}{#1}%
	\ifthenelse{\equal{\chex}{N}}%
	{	\ifthenelse{\value{currentlevel} = 6}%
		{	\ifthenelse{#1 > 1}{\addtocounter{currentlevel}{1}}%
				{\addtocounter{currentlevel}{-1}}}{}}{}%
	\ifthenelse{\value{currentlevel} < 1}{\setcounter{currentlevel}{1}}{}%
	\ifthenelse{\value{currentlevel} > 7}{\setcounter{currentlevel}{7}}{}%
}

\newcommand{\levelchange}[2]% title, uppity
{	\findnewlevel{#2}%
	\ifthenelse{\value{currentlevel} = 1}{\subparagraph{#1}}{}%
	\ifthenelse{\value{currentlevel} = 2}{\paragraph{#1}}{}%
	\ifthenelse{\value{currentlevel} = 3}{\subsubsection{#1}}{}%
	\ifthenelse{\value{currentlevel} = 4}{\subsection{#1}}{}%
	\ifthenelse{\value{currentlevel} = 5}{\section{#1}}{}%
	\ifthenelse{\value{currentlevel} = 6}{\chapter{#1}}{}%
	\ifthenelse{\value{currentlevel} = 7}{\part{#1}}{}%
}

\newcommand{\levelup}[1]{\levelchange{#1}{1}}
\newcommand{\leveldown}[1]{\levelchange{#1}{-1}}
\newcommand{\levelstay}[1]{\levelchange{#1}{0}}
\newcommand{\levelmultiup}[2]{\levelchange{#1}{#2}} %title, uppity