ITM-Thesis Class Repository
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
This repo is archived. You can view files and clone it, but cannot push or open issues/pull-requests.

154 lines
4.9 KiB

  1. %************************************
  2. %1 Identification:
  3. \NeedsTeXFormat{LaTeX2e}
  4. \ProvidesClass{itmthesis}[2018/05/04 ITMorelia Thesis Class by Gerardo Marx]
  5. %************************************
  6. %2 Preliminary declarations
  7. %2.1 The basic class:
  8. \LoadClass{report}
  9. %2.2 Packages:
  10. \RequirePackage[utf8]{inputenc}
  11. \RequirePackage[colorlinks=true]{hyperref}
  12. \RequirePackage{blindtext}
  13. %2.2.1 Booleans
  14. \RequirePackage{ifthen}
  15. \newboolean{@drafting} % print version information on pages
  16. \newboolean{@spanish} % activates the spanish version at babel otherwise english
  17. \newboolean{@listings} % loads the listings package
  18. %2.2.2 Colors
  19. \RequirePackage{xcolor}
  20. \definecolor{c1}{rgb}{0,0,1} % blue
  21. \hypersetup{
  22. linkcolor={c1}, % internal links
  23. citecolor={c1}, % citations
  24. urlcolor={c1} % external links/urls
  25. }
  26. %2.2.2 This package is essentially a replacement—partial or total—for the LATEX macros related with sections—namely titles, headers and contents.
  27. \RequirePackage{titlesec}
  28. %
  29. \RequirePackage{xargs} % needed for extended newcommand and others
  30. \RequirePackage{array} % needed for extended options for array
  31. \RequirePackage{amsmath}
  32. %2.3 Page settings:
  33. \RequirePackage[left=3cm,right=3cm,top=3cm,bottom=3cm]{geometry}
  34. %2.4 Macros and Commands:
  35. %Commands
  36. \newcommand{\myVersion}{version 1.0\xspace}
  37. %2.4.1 Derivatives
  38. \newcommandx{\pd}[3][1=]{%
  39. \frac{\partial^{#1} #2}{\partial #3^{#1}}
  40. }
  41. %2.4.1 Dbf
  42. \renewcommand{\d}{{\rm d}}
  43. %2.5 Environments:
  44. %2.5.1 Arrays of equations:
  45. %************************************
  46. %3 Options:
  47. % 3.1 DeclareOptions
  48. % Option sintax
  49. % \DeclareOption{⟨option⟩}{⟨code⟩}
  50. %Code option:
  51. \DeclareOption{drafting}{
  52. %Code
  53. \setboolean{@drafting}{true}
  54. }
  55. \DeclareOption{spanish}{
  56. %Code
  57. \setboolean{@spanish}{true}
  58. \typeout{spanish to babel}
  59. }%end code option
  60. \DeclareOption{listings}{
  61. \setboolean{@listings}{true}
  62. \typeout{listings option activated}
  63. }
  64. \ProcessOptions\relax
  65. % 3.2 PassOptionsToPackage
  66. %if sintax: \ifthenelse{⟨test⟩}{⟨then clause⟩}{⟨else clause⟩}
  67. % 3.2.1 drafting
  68. %+++++++++++++++++++++++++++++++++++++++++++++
  69. \RequirePackage{scrtime} %time access
  70. %Sintax: \newcommand{name}[num]{definition}
  71. \newcommand{\finalVersionString}{Revised}%Final version text
  72. \ifthenelse{\boolean{@drafting}}{%
  73. % Then clause
  74. % \RequirePackage{draftwatermark}%
  75. % \SetWatermarkLightness{0.9}
  76. % \SetWatermarkScale{.5}
  77. % \SetWatermarkText{\today\ at \thistime}
  78. \RequirePackage{prelim2e}
  79. \PassOptionsToPackage{draft}{prelim2e}
  80. \renewcommand{\PrelimWords}{\relax}
  81. \renewcommand{\PrelimText}{\footnotesize[\,\today\ at \thistime\ -- \texttt{itmorelia} \myVersion\,]}
  82. }
  83. %else clause
  84. {\renewcommand{\finalVersionString}{\emph{Final Version} as of \today\ (\texttt{itmorelia} \myVersion).}}
  85. %+++++++++++++++++++++++++++++++++++++++++++++
  86. % 3.2.2 babel
  87. \ifthenelse{\boolean{@spanish}}%test
  88. { %then clause
  89. \@ifpackageloaded{babel}
  90. {\relax}{\RequirePackage[spanish]{babel}}%
  91. }
  92. {\relax}% else clause
  93. %3.2.3 Listing related stuff
  94. \ifthenelse{\boolean{@listings}}%
  95. {%then clause
  96. \@ifpackageloaded{listings}%
  97. {\relax}{\RequirePackage{listings}}%
  98. }
  99. %else clause
  100. {\relax}%
  101. %************************************
  102. % 4 Declarations:
  103. %-------------------------------------
  104. %4.0 chapter
  105. %\renewcommand{\thechapter}{\Roman{chapter}} %Roman enumeration
  106. \titleformat{\chapter}[display]%shape
  107. {\Huge\filleft\sc}%Format applied to the title
  108. {\filleft\sc{\chaptertitlename} \thechapter}%Label text and format
  109. {4ex}%Separation between Label and Title
  110. {}%Before code
  111. [\vspace{2ex}
  112. \color{gray}\titlerule]%After code
  113. %
  114. %4.1 section
  115. %\titleformat{\section}%shape
  116. % {\large \scshape}%Format applied to the title
  117. % {\large\scshape \thesection}%Label text and format
  118. % {2ex}%Separation between Label and Title
  119. % {}%Before code
  120. % []%After code
  121. \titleformat{\section}
  122. {\normalfont\Large\bfseries}{\thesection}{1em}{}
  123. %4.2 subsection
  124. \titleformat{\subsection}
  125. {\normalfont\large\bfseries}{\thesubsection}{1em}{}
  126. %4.3 subsubsection
  127. \titleformat{\subsubsection}
  128. {\normalfont\normalsize\bfseries}{\thesubsubsection}{1em}{}
  129. %4.4 Paragraph
  130. \titleformat{\paragraph}[runin]
  131. {\normalfont\normalsize\bfseries}{\theparagraph}{1em}{}
  132. %4.5 subparagraph
  133. \titleformat{\subparagraph}[runin]
  134. {\normalfont\normalsize\bfseries}{\thesubparagraph}{1em}{}
  135. %4.2 subsection
  136. \titleformat{\subsection}
  137. {\normalfont\Large\bfseries}{\thesubsection}{1em}{}
  138. %4.x Spacing
  139. \titlespacing*{\chapter} {0pt}{50pt}{40pt}
  140. \titlespacing*{\section} {0pt}{3.25ex plus 1ex minus .2ex}{2.3ex plus .2ex}
  141. \titlespacing*{\subsection}{0pt}{3.25ex plus 1ex minus .2ex}{1.5ex plus .2ex}
  142. \titlespacing*{\subsubsection}{0pt}{3.25ex plus 1ex minus .2ex}{1.5ex plus .2ex}
  143. \titlespacing*{\paragraph}{0pt}{3.25ex plus 1ex minus .2ex}{1em}
  144. \titlespacing*{\subparagraph}{\parindent}{3.25ex plus 1ex minus .2ex}{1em}