summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/chapterfolder/chapterfolder.sty
blob: c701a02cabd6b15ad0bac9750c8b04b73e94a8d7 (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
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
%%
%% This is file `chapterfolder.sty',
%% generated with the docstrip utility.
%%
%% The original source files were:
%%
%% chapterfolder.dtx  (with options: `package')
%% This is a generated file.
%% 
%% Copyright (C) 2003-2005 by Mathieu Boretti
%% 
%% This file may be distributed and/or modified under the
%% conditions of the LaTeX Project Public License, either
%% version 1.3 of this license or (at your option) any later
%% version. The latest version of this license is in:
%% 
%% http://www.latex-project.org/lppl.txt
%% 
%% and version 1.3 or later is part of all distributions of
%% LaTeX version 2003/12/01 or later.
%% 
%% The current Maintainer of this work is Mathieu Boretti
%% 
%% This work consists of the file chapterfolder.ins and
%% chapterfolder.dtx and the derived file chapterfolder.sty
\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{chapterfolder}[2005/11/24 v2.0 Package for dealing with folder]
\RequirePackage{ifthen}
\newcounter{@cf@currentpos}
\setcounter{@cf@currentpos}{0}
\expandafter\def\csname stackFolder0\endcsname{}
\expandafter\def\csname stackFolder1\endcsname{}
\expandafter\def\csname stackFolder2\endcsname{}
\expandafter\def\csname stackFolder3\endcsname{}
\expandafter\def\csname stackFolder4\endcsname{}
\expandafter\def\csname stackFolder5\endcsname{}
\expandafter\def\csname stackFolder6\endcsname{}
\expandafter\def\csname stackFolder7\endcsname{}
\expandafter\def\csname stackFolder8\endcsname{}
\expandafter\def\csname stackFolder9\endcsname{}
\def\@cfpush#1{%
    \expandafter%
    \def\csname stackFolder\arabic{@cf@currentpos}\endcsname{#1/}%
    \addtocounter{@cf@currentpos}{1}%
}
\def\@cfpop{%
    \addtocounter{@cf@currentpos}{-1}
    \expandafter%
    \def\csname stackFolder\arabic{@cf@currentpos}\endcsname{}%
}
\newcommand{\cfcurrentfolder}{%
\csname stackFolder0\endcsname%
\csname stackFolder1\endcsname%
\csname stackFolder2\endcsname%
\csname stackFolder3\endcsname%
\csname stackFolder4\endcsname%
\csname stackFolder5\endcsname%
\csname stackFolder6\endcsname%
\csname stackFolder7\endcsname%
\csname stackFolder8\endcsname%
\csname stackFolder9\endcsname%
}
\newcommand{\cfinput}[1]{\input{\cfcurrentfolder#1}}
\newcommand{\cffolderinput}[2]{%
    \@cfpush{#1}%
    \cfinput{#2}%
    \@cfpop%
}
\newcommand{\cfaddFolder}[2]{%
    \expandafter\def\csname cfcurrentfolder#1\endcsname{%
        \cfcurrentfolder/#2/%
    }%
    \expandafter\def\csname cfinput#1\endcsname##1{%
        \input{\csname cfcurrentfolder#1\endcsname##1}%
    }%
}
\newcommand{\@chapterfolderfigure}{figure}
\cfaddFolder{figure}{\@chapterfolderfigure}
\newcommand{\cfincludegraphics}[2][]{%
    \includegraphics[#1]{\cfcurrentfolderfigure/#2}%
}
\newcommand{\@chapterfolderlistings}{listings}
\cfaddFolder{listings}{\@chapterfolderlistings}
\newcommand{\@chapterfolderalgorithms}{algorithms}
\cfaddFolder{algorithms}{\@chapterfolderalgorithms}
\newcommand{\cfpart}{\@ifstar
  \cfpartstar%
  \cfpartstd%
}
\newcommand{\cfchapter}{\@ifstar
  \cfchapterstar%
  \cfchapterstd%
}
\newcommand{\cfsection}{\@ifstar
  \cfsectionstar%
  \cfsectionstd%
}
\newcommand{\cfsubsection}{\@ifstar
  \cfsubsectionstar%
  \cfsubsectionstd%
}
\newcommand{\cfpartstd}[4][]{%
\ifthenelse{\equal{#1}{}}{\part{#2}}{\part[#1]{#2}}%
\cffolderinput{#3}{#4}%
}
\newcommand{\cfpartstar}[4][]{%
\ifthenelse{\equal{#1}{}}{\part*{#2}}{\part[#1]{#2}}%
\cffolderinput{#3}{#4}%
}
\newcommand{\cfchapterstd}[4][]{%
\ifthenelse{\equal{#1}{}}{\chapter{#2}}{\chapter[#1]{#2}}%
\cffolderinput{#3}{#4}%
}
\newcommand{\cfchapterstar}[4][]{%
\ifthenelse{\equal{#1}{}}{\chapter*{#2}}{\chapter*[#1]{#2}}%
\cffolderinput{#3}{#4}%
}
\newcommand{\cfsectionstd}[4][]{%
\ifthenelse{\equal{#1}{}}{\section{#2}}{\section[#1]{#2}}%
\cffolderinput{#3}{#4}%
}
\newcommand{\cfsectionstar}[4][]{%
\ifthenelse{\equal{#1}{}}{\section*{#2}}{\section*[#1]{#2}}%
\cffolderinput{#3}{#4}%
}
\newcommand{\cfsubsectionstd}[4][]{%
\ifthenelse{\equal{#1}{}}{\subsection{#2}}{\subsection[#1]{#2}}%
}
\newcommand{\cfsubsectionstart}[4][]{%
\ifthenelse{\equal{#1}{}}{\subsection*{#2}}{\subsection*[#1]{#2}}%
\cffolderinput{#3}{#4}%
}
\endinput
%%
%% End of file `chapterfolder.sty'.