summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/chapterfolder/chapterfolder.sty
blob: 4e4f7fc4c3fac1686240c8d64a5f8301494f5907 (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
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
%%
% Fichier : chapterfolder.sty
%
% Auteur  : Boretti Mathieu
%
% Licence : lppl
% This material is subject to the LaTeX Project Public License. See http://www.ctan.org/tex-archive/help/Catalogue/licenses.lppl.html  for the details of that license.
%
% revision, version 1.1
%
%%
\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{chapterfolder}
\RequirePackage{ifthen}
%
\newcommand{\@chapterfoldercurrentfolder}{}
%
\newcommand{\@partfoldercurrentfolder}{}
%
\newcommand{\@sectionfoldercurrentfolder}{}
%
\newcommand{\@subsectionfoldercurrentfolder}{}
%
\newcommand{\@chapterfolderfigure}{figure/}
%
\newcommand{\@chapterfolderlistings}{listings/}
%
%
% \cfcurrentfolder
\newcommand{\cfcurrentfolder}{\@partfoldercurrentfolder\@chapterfoldercurrentfolder\@sectionfoldercurrentfolder\@subsectionfoldercurrentfolder}
% \cfcurrentfolderfigure
\newcommand{\cfcurrentfolderfigure}{\cfcurrentfolder\@chapterfolderfigure}
% \cfcurrentfolderlistings
\newcommand{\cfcurrentfolderlistings}{\cfcurrentfolder\@chapterfolderlistings}
%
\newcommand{\@cfuppart}[1]{\renewcommand{\@partfoldercurrentfolder}{#1/}}
\newcommand{\@cfupchapter}[1]{\renewcommand{\@chapterfoldercurrentfolder}{#1/}}
\newcommand{\@cfupsection}[1]{\renewcommand{\@sectionfoldercurrentfolder}{#1/}}
\newcommand{\@cfupsubsection}[1]{\renewcommand{\@subsectionfoldercurrentfolder}{#1/}}
\newcommand{\@cfdownpart}{\renewcommand{\@partfoldercurrentfolder}{}}
\newcommand{\@cfdownchapter}{\renewcommand{\@chapterfoldercurrentfolder}{}}
\newcommand{\@cfdownsection}{\renewcommand{\@sectionfoldercurrentfolder}{}}
\newcommand{\@cfdownsubsection}{\renewcommand{\@subsectionfoldercurrentfolder}{}}
%
% \cfinput{nom}
\newcommand{\cfinput}[1]{\input{\cfcurrentfolder#1}}

% \cfpart[name short]{name full}{folder}{file}
\newcommand{\cfpart}[4][]{%
\@cfuppart{#3}%
\ifthenelse{\equal{#1}{}}{\part{#2}}{\part[#1]{#2}}%
\cfinput{#4}%
\@cfdownpart%
}

% \cfpartstar[name short]{name full}{folder}{file}
\newcommand{\cfpartstar}[4][]{%
\@cfuppart{#3}%
\ifthenelse{\equal{#1}{}}{\part*{#2}}{\part[#1]{#2}}%
\cfinput{#4}%
\@cfdownpart%
}

% \cfchapter[name short]{name full}{folder}{file}
\newcommand{\cfchapter}[4][]{%
\@cfupchapter{#3}%
\ifthenelse{\equal{#1}{}}{\chapter{#2}}{\chapter[#1]{#2}}%
\cfinput{#4}%
\@cfdownchapter%
}

% \cfchapterstar[name short]{name full}{folder}{file}
\newcommand{\cfchapterstar}[4][]{%
\@cfupchapter{#3}%
\ifthenelse{\equal{#1}{}}{\chapter*{#2}}{\chapter*[#1]{#2}}%
\cfinput{#4}%
\@cfdownchapter%
}

% \cfsection[name short]{name full}{folder}{file}
\newcommand{\cfsection}[4][]{%
\@cfupsection{#3}%
\ifthenelse{\equal{#1}{}}{\section{#2}}{\section[#1]{#2}}%
\cfinput{#4}%
\@cfdownsection%
}

% \cfsectionstar[name short]{name full}{folder}{file}
\newcommand{\cfsectionstar}[4][]{%
\@cfupsection{#3}%
\ifthenelse{\equal{#1}{}}{\section*{#2}}{\section*[#1]{#2}}%
\cfinput{#4}%
\@cfdownsection%
}

% \cfsubsection[name short]{name full}{folder}{file}
\newcommand{\cfsubsection}[4][]{%
\@cfupsubsection{#3}%
\ifthenelse{\equal{#1}{}}{\subsection{#2}}{\subsection[#1]{#2}}%
\cfinput{#4}%
\@cfdownsubsection%
}

% \cfsubsectionstar[name short]{name full}{folder}{file}
\newcommand{\cfsubsectionstart}[4][]{%
\@cfupsubsection{#3}%
\ifthenelse{\equal{#1}{}}{\subsection*{#2}}{\subsection*[#1]{#2}}%
\cfinput{#4}%
\@cfdownsubsection%
}