framabook_thermo-couleur.sty 26.4 KB
Newer Older
1 2 3 4 5 6 7 8 9 10
% Olivier’s custom layout for the thermodynamics framabook


%%%%%%%%%%%%%%%%%
% Packages
%%%%%%%%%%%%%%%%%

% Fonts and encoding stuff for documents typed in French

% Load font Libertine, overriding the fonts from Framaquette
11 12 13 14
% Attention, seul le paquet LaTeX "libertine-legacy" fournit
% les fontes penchées (et non italiques) utilisées dans le 
% livre de thermodynamique. Voir la page 
% https://tex.stackexchange.com/questions/260535/how-can-i-use-the-slanted-variant-of-the-libertine-font
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
\usepackage{libertine}
\usepackage[libertine]{newtxmath}
\renewcommand{\entetefont}{}
\renewcommand{\sectionfont}{}

\frenchbsetup{AutoSpacePunctuation=false} % Prevent frenchb from automatically adding spaces before :;! if they are not typed (pain in the butt in hyperlinks etc).

% A few hacks for French language
\newcommand{\iieme}{\up{e}\xspace}
\hyphenation{Lors-que}
\hyphenation{mê-me}
\hyphenation{mê-mes}
\hyphenation{aug-men-ter}
\hyphenation{figure}

\usepackage{subfigure}
\usepackage{caption}
	\captionsetup{font={footnotesize}}
\usepackage[section]{placeins} 	% All floats (figures & tables) must be cleared before a new section
\usepackage{flafter}					% so figures/tables are always displayed after insertion (does not seem to work here)
\usepackage[hyperref=true,sorting=ynt,backend=biber]{biblatex} % Bibliography
	\addbibresource{annexes/thermobib.bib}
	\renewcommand*{\bibfont}{\footnotesize}	% réduire la taille des références


%%%% Misc %%%%

\usepackage{mdframed} 		% Better framed boxes than framed
\usepackage{titlesec}		% for customizing section titles with \titleformat
\usepackage{lscape}		% so individual pages can be set to landscape

\usepackage[export]{adjustbox}	% Allow use of "max width" argument in \includegraphics
											%'export' allows adjustbox keys in \includegraphics
\let\oldincludegraphics\includegraphics % Make sure \includegraphics never exceeds text width line
\renewcommand{\includegraphics}[2][]{\oldincludegraphics[#1,max width=\columnwidth]{#2}}


%%%% Tables %%%%

%\usepackage{tabulary}		% tabulary breaks when using arydshln so now we use tabularx instead
\usepackage{tabularx}		% For long tables split over several pages
\usepackage{longtable}		% so we can use tables spreading over several pages
\usepackage{booktabs}		% Needed for tables
\usepackage{arydshln}		% so we can get dotted lines in tables


%%%%%%%%%%%%%%%%%
% Tables of content
%%%%%%%%%%%%%%%%%

% Initialize a few dummy commands that are re-named at each chapter
\newcommand{\nomducours}{XXX} 		% need to initialize command
\newcommand{\sousnomducours}{XXX} 	% need to initialize command
\newcommand{\chapterlabel}{XXX} 		% need to initialize command
69 70 71
\newcommand{\lastedityear}{1901}
 \newcommand{\lasteditmonth}{01}
   \newcommand{\lasteditday}{01}
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 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207

\usepackage[subfigure]{tocloft}			% Tocloft allows control of Table of Contents format. Option [subfigure] to prevent clash with subfigure package
	\renewcommand{\cftdot}{} 				% remove dots
	\setcounter{tocdepth}{1} 				% depth of ToC
	\setlength{\cftbeforechapskip}{0.8cm} 	% space before "parts" in ToC
	\setlength{\cftbeforesecskip}{0.3cm}	% space before subsections in ToC
	\setlength{\cftsecindent}{1.25cm}		% indent before subsections in ToC
	\setlength{\cftsecnumwidth}{3em}			% length of number width in ToC for \section
	\setlength{\cftsubsecnumwidth}{3em}		% length of number width in ToC for \subsection
	\setlength{\cftsubsubsecnumwidth}{4em}	% length of number width in ToC for \subsubsection
\renewcommand{\cfttoctitlefont}{\center \huge}
\renewcommand*\l@section{\@dottedtocline{1}{0em}{2.3em}}
\renewcommand*\l@subsection{\@dottedtocline{2}{2.6em}{3em}}


% Environment to write chapter summary and intro
\newenvironment{tetedechapitre}[1][]{%
	\vspace*{\stretch{1}}
	\begin{center}
		\begin{minipage}{0.8\textwidth}
			\begin{center}Le chapitre en bref\end{center}
			\begin{itshape}
				#1\par
			\end{itshape}
			\begin{center}\ding{105}\end{center}
}
{\end{minipage}\end{center}\vspace*{\stretch{1}}\clearpage}


%%%%%%%%%%%%%%%%%
% Overall appearance
%%%%%%%%%%%%%%%%%

% page size
\geometry{a4paper,
				top=1.5cm,
				bottom=1cm,
				includeall,
				inner=3cm,
				outer=3cm,
				bindingoffset=1cm,
				marginparwidth=0cm,
				marginparsep=0cm,
				headheight=1cm,
				headsep=1cm,
				}

\newcommand{\fancyheaddefaultvalue}{0cm} % so we can use this value dynamically elsewhere
\newcommand{\fancyfootdefaultvalue}{3.4cm} % so we can use this value dynamically elsewhere
\newcommand{\restoredefaultheadoffset}{\fancyheadoffset[LE,RO]{\fancyheaddefaultvalue}}
\restoredefaultheadoffset % initializing value

% Redefine mainmatter and backmatter (!!!!!!) to get rid of useless repetitions in header
\renewcommand\mainmatter{%
  \cleardoublepage
  \@mainmattertrue
  \@frontmatterfalse
  \pagenumbering{arabic}
  \let\index\indexORI
  \fancyfoot{}
  \fancyhead[LE]{\entetefont \thepage}
  \fancyhead[RO]{\entetefont \thepage}
  \fancyhead[LO]{}
  \fancyhead[RE]{\entetefont Chapitre \thechapter~:~\nomducours}
 }

\renewcommand\backmatter{%
  \cleardoublepage
  \@mainmatterfalse
  \@frontmatterfalse
  \fancyfoot{}
  \fancyhead[LE]{\entetefont \thepage}
  \fancyhead[RO]{\entetefont \thepage}
  \fancyhead[LO]{}
  \fancyhead[RE]{\entetefont \chaptermark}
 % \renewcommand{\toclevel@chapter}{-1}% pour avoir le bookmark au même niveau que part
}


% Redefine plain fancyhdr style to get rid of page number in chapter page (who is going to find it there anyway??)
\fancypagestyle{plain}{%
  \fancyhf{}
  \fancyfoot{}
 }

% Create shortcut to restore default (as defined in framatex_entete_titres.sty) footers and headers
\newcommand{\restoredefaultfootersandheaders}{%
	\fancyhead[LE,RO]{\entetefont \thepage}
	\fancyhead[LO]{\rightmark}
	\fancyhead[RE]{\leftmark}
}

% \Large is for wimps
\newcommand\QuiteHuge{\@setfontsize\Huge{40}{40}} 
\newcommand\HUGE{\@setfontsize\Huge{50}{50}}
\newcommand\MEGAHUGE{\@setfontsize\Huge{70}{70}}
\newcommand\abaqueunfontsize{\@setfontsize\scriptsize{9.5}{11}} 	%taille des caractères de l’abaque n°1
\newcommand\abaquedeuxtroisfontsize{\footnotesize}						%taille des caractères des abaques n°2 et 3

% typeset hyphens outside of paragraph body
% Warning: if microtype package is too old (e.g. v2.4) compilation times
% rise dramatically (from ~ 8 min to ~ 6 hours)!
\usepackage[]{microtype} 

% Prevent pagebreaks at the start of lists
\@beginparpenalty=10000

% Control spacing around figures
\setlength{\textfloatsep}{20pt plus 2pt minus 2pt} 	% figure-texte, flottaisons placées par LaTeX
\setlength{\intextsep}{20pt plus 2pt minus 2pt}			% figure-texte, flottaisons plaquées avec [h]
\setlength{\floatsep}{20pt plus 2pt minus 2pt}			% espace entre 2 flottaisons placées ensemble (en haut ou en bas) par LaTeX
\setlength{\dbltextfloatsep}{20pt plus 2pt minus 2pt}	% flottaisons traversant 2 colonnes en twocolumn
\setlength{\belowcaptionskip}{-\baselineskip}			% espace entre le caption et la suite

% Make figure placement less strict with regards to text
\renewcommand{\topfraction}{.85}
\renewcommand{\bottomfraction}{.7}
\renewcommand{\textfraction}{.15}
\renewcommand{\floatpagefraction}{.66}
\renewcommand{\dbltopfraction}{.66}
\renewcommand{\dblfloatpagefraction}{.66}
\setcounter{topnumber}{9}
\setcounter{bottomnumber}{9}
\setcounter{totalnumber}{20}
\setcounter{dbltopnumber}{9}

% Gadgets
\usepackage{ccicons} 	% Use Creative Commons icons in text
\usepackage{pifont}		% Use \ding{105} in chapter intros

% Tool to prevent pagebreaks in exercises (with \needspace{10cm})
\usepackage{needspace}

% Shift margin in descriptions by a teensie bit right 
% (so that tabs in exercise solutions do not break indentation)
\usepackage{enumitem}
208
\setlist[description]{leftmargin=1.2cm,labelsep=0.3em} % as close to "one space" as possible
209
\setlist[itemize]{leftmargin=2em} % resserer les "item" des listes en tiret un peu sur la gauche
210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317

%%%%%%%%%%%%%%%%%
% Numbering and titles
%%%%%%%%%%%%%%%%%

% Create a shortcut for recreating the default (as described in framatex_entete_titres.sty) section style
\newcommand{\restoredefaultsectionstyle}{%
		\renewcommand{\section}{%
		 	\@startsection%
		 	{section}%
		 	{1}%
		 	{\sectiontitleindent}%
		 	{-3.5ex plus -1ex minus -.2ex}%
		 	{2.3ex plus.2ex}%
			{\clearfloats\sectionfont\large}}
}

% And create a shortcut for making an alternate version of it
\newcommand{\centeredsectionstyle}{%
		\renewcommand{\section}{%
		 	\@startsection%
		 	{section}%
		 	{1}%
		 	{0pt}%
		 	{0pt}%
		 	{0pt}%
			{\large}}
}

% Table and figure numbering
\renewcommand{\thefigure}{\thechapter.\arabic{figure}}
\renewcommand{\thetable}{\thechapter.\arabic{table}}

% Replace "Table" with "Tableau" (French)
\AtBeginDocument{%
  \renewcommand\tablename{\textsc{Tableau}}
}

% Custom equation numbering
\renewcommand{\theequation}{\thechapter/\arabic{equation}}

\titleformat{\subsubsection}{\vspace{1em}\pagebreak[3]\needspace{8em}\titlerule\vspace{0.08em}\normalsize\raggedright}{\thesubsubsection\nopagebreak}{1em}{}[] %encourage pagebreak with [1] before subsub, prevent it immediately afterwards. \wherefrom also prevents pagebreaks
\renewcommand\thesubsubsection{E~\thechapter.\arabic{subsubsection}} % cheat for renumbering, pretend it’s a subsection
\setlength{\subsubsectiontitleindent}{0cm} % remove indent
\newcommand\sectionbreak{\clearfloats}			% clear floats before each section
\newcommand\subsectionbreak{\clearfloats}		% clear floats before each subsection
\newcommand\subsubsectionbreak{\clearfloats}	% clear floats before each subsubsection (exercise)

% internal links use \cref (package cleveref) which is called very late to workaround some conflict bug.

%%%%%%%%%%%%%%%%%
% Style changes inside the book
%%%%%%%%%%%%%%%%%

\newcommand{\exercisepagegeometry}{\newgeometry{twocolumn, columnsep=0.75cm, top=1.5cm, bottom=1.5cm, inner=2.5cm, outer=2cm, includeall, footskip=0cm, marginparwidth=0pt, marginparsep=0pt}}
\newcommand{\solutionpagegeometry}{\newgeometry{onecolumn, columnsep=0cm, top=1.5cm, bottom=1.5cm, inner=2.5cm, outer=2cm, includeall, footskip=0cm, marginparwidth=0pt, marginparsep=0pt}}
\newcommand{\narrowcenteredpagegeometry}{\newgeometry{inner=5cm,outer=5cm,top=2cm,bottom=2cm,ignoreall,marginparwidth=0pt, marginparsep=0pt}}

\newcommand{\atstartofexercices}{%
	\centeredsectionstyle
	\exercisepagegeometry%
	\fancyheadoffset[LE,RO]{0cm}%
	\begin{spacing}{1}%
	\begin{footnotesize}
	\keepvalues\setlength{\parindent}{0pt}
	\section{Exercices}
}

% Commande de stockage et de restauration des valeurs par défaut de \parindent et \parskip
\newcommand{\keepvalues}{%
  \edef\restorevalues{%
    \parindent=\the\parindent
    \parskip=\the\parskip
  }%
}

\newcommand{\exercisesolutionpage}{%
	\pagebreak
	\restorevalues
	\restoregeometry
	\restoredefaultheadoffset
	\solutionpagegeometry\pagebreak
}

% titre pour les résultats/solutions des exercices
\newcommand{\titreresultats}{\noindent\begin{large}Résultats\end{large}}

\newcommand{\atendofexercices}{%
	\restorevalues
	\end{footnotesize}
	\end{spacing}%
	\restoredefaultsectionstyle%
	\restoregeometry%
	\restoredefaultheadoffset%
}


%%%%%%%%%%%%%%%%%
% General styles, colors, and math settings
% Used to be trucscommunsdolivier.sty (settings common to all of Olivier’s LaTeX documents)
%%%%%%%%%%%%%%%%%

%%%%%%%%%%% Misc useful %%%%%%%%%% 

\usepackage[numbered]{bookmark} % Configures table of contents in PDF bookmarks
\usepackage{comment} % so sections can be commented with \begin{comment}, \end{comment}
\usepackage{tabto} % emulate "Tab" key with \tab
	\TabPositions{0.5\columnwidth} % position of tab. Can also use \NumTabs{4} (number of tabs in line)
318
\usepackage[gen]{eurosym} % Use euro symbol with \euro{}
319 320 321
\usepackage{xspace}	% to use the command \xspace (trailing space sensitive to whether character that follows is punctuation or not)


322 323 324 325 326 327
% Use cref (cleveref) to make internal links; configure French language.
% Cleveref must be called before IEEEtrantools to prevent clashes
\usepackage[french,nameinlink]{cleveref}
   \crefformat{equation}{#2équation~#1#3}


328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377
%%%%%%%%%%% Math %%%%%%%%%% 

\usepackage{amsmath}			% equations
\usepackage{amssymb}			% Math symbols
\usepackage[retainorgcmds]{IEEEtrantools} 	% robust multi-line equation alignment
\usepackage{siunitx}			% for SI units and numbers
	\sisetup{retain-explicit-plus = true,
				exponent-product = \cdot,
				output-decimal-marker = {,},
				unit-color = unitcolor,
				group-digits = integer, % groups numbers together, but not in decimals
				group-minimum-digits = 3,
				table-number-alignment = center, % numbers in tables centered --requires each column is described with "table-format = X.Y" where X is integers and Y is decimals.
				}

\DeclareSIUnit[number-unit-product = { }]
	\euroo{\euro{}} % so "\euroo" can be used as a normal unit
\DeclareSIUnit\bar{bar}
\DeclareSIUnit\lbf{lb_f}
\DeclareSIUnit\foot{ft}
\DeclareSIUnit\cheval{ch}
\DeclareSIUnit\horsepower{hp}
\DeclareSIUnit\usi{u.\textsc{si}}


% In order to retain conventional "/" when writing units to obtain, say, kg/(kWh)
% use [per-mode = symbol] argument when calling \SI
				
%\thickmuskip=10mu minus 8mu % increase spacing around the equal sign in equations

% Code that enables \ztag{} (to replace \tag{}) inside IEEEeqnarray equations
\makeatletter
\newcommand\ztag[1]{%
\def\@currentlabel{#1}%
\gdef\tmp{%
\addtocounter{equation}{-1}%
\def\theequation{#1}}%
\aftergroup\aftergroup\aftergroup\aftergroup\aftergroup\aftergroup
\aftergroup\aftergroup\aftergroup\aftergroup\aftergroup\aftergroup
\aftergroup\aftergroup\aftergroup\aftergroup\aftergroup\aftergroup
\aftergroup\aftergroup\aftergroup\aftergroup\aftergroup\aftergroup
\aftergroup\aftergroup\aftergroup\aftergroup\aftergroup\aftergroup
\aftergroup %wehee ! From https://tex.stackexchange.com/questions/149370/ieeeeqnarray-tag-like-command
\tmp}


%%%%%%%%%% Colors %%%%%%%%%%

\usepackage[]{xcolor}			% provides library of colors (used in siunitx + hyperref)
	\definecolor{unitcolor}{HTML}{333333} % → also check out svgnames for pre-defined colors
378 379 380
	\definecolor{vocabcolor}{HTML}{460B00}
	\definecolor{externallinkcolor}{HTML}{0B0051}
	\definecolor{internallinkcolor}{HTML}{000928}
381
	\definecolor{examplebackgroundcolor}{rgb}{.95,.95,.95} % this is html f3f3f3ff
382 383
	\definecolor{quotebackgroundcolor}{rgb}{.95,.95,.95}
	\definecolor{exampletextcolor}{HTML}{333333}
384 385
	\definecolor{equationtermscolor}{HTML}{1B1B1B}
	\definecolor{attributioncolor}{HTML}{000000}
386 387 388 389 390 391 392 393

%%%%%%%%%% Useful custom tools %%%%%%%%%%

% Custom command to *not* break page. Simply type \dontbreakpage  (used after each "introduction" section)
\newcommand\dontbreakpage{\vspace{1em}\par\nobreak\@afterheading}
\newcommand\puredontbreakpage{\par\nobreak\@afterheading}

% "diff" symbol in math equations
394 395 396 397
\newcommand{\diff}{\,\mathrm{d}}				% differential
\newcommand{\tdiff}{\mathrm{d}}					% differential, no leading space
\newcommand{\diffi}{\,\textrm{\greektext d}}	% inexact differential
\newcommand{\tdiffi}{\textrm{\greektext d}}		% inexact differential, no leading space
398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515

% shortcut to convert temperatures
\newcommand{\plustwoseventhree}{+\num{273,15}}

% shortcuts for commonly-used subscripts in equations
\newcommand{\fromatob}{{\text{A}\to\text{B}}}
\newcommand{\frombtoa}{{\text{B}\to\text{A}}}
\newcommand{\frombtoc}{{\text{B}\to\text{C}}}
\newcommand{\fromctod}{{\text{C}\to\text{D}}}
\newcommand{\fromdtoa}{{\text{D}\to\text{A}}}
\newcommand{\net}{\text{net}}
\newcommand{\inn}{\text{in}}
\newcommand{\out}{\text{out}}
\newcommand{\A}{\text{A}}
\newcommand{\B}{\text{B}}
\newcommand{\C}{\text{C}}
\newcommand{\D}{\text{D}}
\newcommand{\E}{\text{E}}
\newcommand{\F}{\text{F}}
\newcommand{\G}{\text{G}}

% a more intuitive command for clearing figure & table floats
\newcommand{\clearfloats}{\FloatBarrier}

% Nicer name to shift numbering in {enumerate}: \shift{2}
\newcommand{\shift}[1]{\setcounter{enumi}{#1}}

% Simplify writing vectors
\newcommand{\lvec}{\overrightarrow}

\renewcommand{\ieme}{\up{e}\xspace}

% Book-wide width for p-v & T-s diagrams
\newcommand{\pvdiagramwidth}{8cm}
\newcommand{\didacticpvdiagramwidth}{10cm}
\newcommand{\solutiondiagramwidth}{2.5cm}

%%%%%%%%%% Custom styles %%%%%%%%%%

% Custom style for "principe"
\newenvironment{principe}{\begin{framed}\begin{center}}{\end{center}\end{framed}}

% Custom style for "trucimportant"
\mdfsetup{frametitlealignment=\centering} % Cannot be specified in local {mdframed} options
\newenvironment{trucimportant}{\begin{mdframed}[topline=false, bottomline=false, linewidth=3pt, innerrightmargin=10pt, leftmargin=0pt, innerleftmargin=10pt, skipabove=8pt, skipbelow=8pt]\begin{center}}{\end{center}\end{mdframed}}

% Custom style for a \supercaption{}{} to be used where figures need credits
\newcommand{\supercaption}[2]{%
	\captionsetup{singlelinecheck=off}	
	\caption[ding]{#1
			\begin{credits}#2\end{credits}
		}
}

% Custom style for "credits" (usually used in \supercaption caption).
\newenvironment{credits}{\vspace{-0.8em}\scriptsize\slshape\begin{flushright}}{\end{flushright}\normalsize\upshape} % Environment, used now.

\newcounter{anexamplecounter}[chapter] % [chapter] argument at end to reset to zero at every chapter 
\renewcommand{\theanexamplecounter}{\thechapter.\arabic{anexamplecounter}} 

% Custom style for examples
\newenvironment{anexample}{\pagebreak[3]\refstepcounter{anexamplecounter}\keepvalues\setlength{\parindent}{0pt}\begin{mdframed}[frametitle=Exemple \theanexamplecounter, frametitlefont=\normalfont\bfseries, frametitlerule=false, splittopskip=1em, linewidth=0pt, linecolor=examplebackgroundcolor, backgroundcolor=examplebackgroundcolor, roundcorner=2pt, innerrightmargin=10pt, leftmargin=0pt, innerleftmargin=10pt, innertopmargin=1em, skipabove=8pt, skipbelow=8pt, footnoteinside=true, needspace=4cm]}{\restorevalues\end{mdframed}}

% Custom style for answer box (used inside "anexample" boxes)
\newenvironment{answer}
	{\begin{list}{}{%
		\setlength{\listparindent}{\parindent}%
		\setlength{\itemindent}{\parindent}%
		\setlength{\leftmargin}{0.6cm}%
		\setlength{\rightmargin}{0cm}%
	}\item }%
	{\end{list}}

% Custom style for "remarks" (used inside "answer" boxes)
\newcommand{\hand}{\protect\raisebox{-0.5ex}{\includegraphics[height = 2ex]{images/hand.png}}~}
\newcommand{\info}{\protect\raisebox{-0.3ex}{\includegraphics[height = 2ex]{images/i.png}}~}
\newenvironment{remark}
	{\begin{list}{}{%
		\setlength{\listparindent}{\parindent}%
		\setlength{\itemindent}{\parindent}%
		\setlength{\leftmargin}{0.5cm}%
		\setlength{\rightmargin}{0cm}%
		\small%
	}\item \hand~}%
	{\end{list}}

% Custom style for vocabulary words
\newcommand{\formatvocab}[1]{\textsl{\textcolor{vocabcolor}{#1}}}	% format of vocabulary words tagged with \vocab[]{} (see below)
\newcommand{\vocabe}[1]{\formatvocab{#1}} 		% meant for English vocab words, same appearance as French but no indexation
\NewDocumentCommand\vocab{om}{%						% usage: \vocab{vocabulaire} or \vocab[entrée à indexer]{vocabulaire}
  \IfNoValueTF{#1}{%
    \formatvocab{#2}\index{#2}% optional #1 is empty: we index the vocab term itself
  }{%
    \formatvocab{#2}\index{#1}% optional #1 is given: we index #1 and display the vocab term #2
  }%
}

% Custom style for "boiboite" (used at the start of exercise sheets)
\newenvironment{boiboite}{\begin{framed}\centering}{\end{framed}}

% Custom style for "boiboiboite" (same as boiboite but not centered!)
\newenvironment{boiboiboite}{\begin{mdframed}[linewidth=0.1pt, linecolor=gray, innerrightmargin=10pt, innerleftmargin=10pt, innertopmargin=10pt, innerbottommargin=10pt, skipabove=8pt, skipbelow=8pt, roundcorner=2pt]}{\end{mdframed}}

% Custom style for indicating where exercices come from (DS)
\newcommand{\wherefrom}[1]{\nopagebreak} % don’t display anything, but prevent page breaks

\newcommand{\atstartofhistorysection}{\clearpage}
\newcommand{\atendofhistorysection}{} % don’t display anything

% Custom style for floating quotes aside the text. For some reason an environment does not work.
\newcommand{\thermoquotebegin}[1]{\begin{wrapfigure}{R}[0pt]{4cm}\vspace{-\intextsep}\scriptsize\begin{spacing}{0.9}\makebox(18,5){\color{gray}\scalebox{2}{«}}}
\newcommand{\thermoquotetopbegin}[1]{\begin{wrapfigure}{R}[0pt]{4cm}\scriptsize\begin{spacing}{0.9}\makebox(18,5){\color{gray}\scalebox{2}{«}}}% same as \thermoquotebegin except for the top margin. To be used instead when the quote ends up at the very top of the page.
\newcommand{\thermoquoteend}[2]{\nolinebreak\makebox(18,5){\color{gray}\scalebox{2}{»}}\par\vspace{-0.3cm}\begin{flushright}#1\\#2\vspace{-2em}\end{flushright}\end{spacing}\end{wrapfigure}}

% Shortcut to provide a nice […] quote shortening shortcut
\newcommand{\jecourte}{{\tiny[...]} }

% Custom style for equation terms description
516
\newenvironment{equationterms}{\puredontbreakpage\footnotesize\vspace{-0.8em}\begin{itemize}\itemsep0pt \parskip0pt \parsep0pt \renewcommand{\labelitemi}{} \renewcommand{\labelitemii}{} \TabPositions{1.3em,2.6em,3em,3.5em,4em,4.5em,5em,5.5em,6em,6.5em,7em,7.5em,8em,8.5em,
517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540
9em,9.5em,10em,10.5em,11em,11.5em,12em,12.5em,13em,13.5em,14em,14.5em,15em,15.5em,16em,16.5em,17em,17.5em,18em,18.5em,
19em,19.5em,20em,20.5em,21em,21.5em,22em,22.5em,23em,23.5em,24em,24.5em,25em}}{\end{itemize}}

% Custom style for chapter "funny" subtitle
\newcommand{\chaptersubtitle}[1]{\begin{center}\begin{large}\textit{\raisebox{0.2em}{\rule{5ex}{0.2ex}}\hspace{1em} ou \hspace{1em}\raisebox{0.2em}{\rule{5ex}{0.2ex}}\\#1}\end{large}\end{center}}

% Ignore code that is called within an \onlyamphibook{}
% Do run code that is called within an \onlyframabook{}
\newcommand{\onlyamphibook}[1]{}
\newcommand{\onlyframabook}[1]{#1}

%%%%%%%%%% Short-hands %%%%%%%%%%

% Simple commands to make links to licenses for re-used pieces of work. Trailing space on purpose.
\newcommand{\pd}{domaine public\xspace}
\renewcommand{\cczero}{\textsl{\textsc{\href{https://creativecommons.org/publicdomain/zero/1.0/deed.fr}{CC-0}}}\xspace}
\renewcommand{\ccby}{\textsl{\textsc{\href{https://creativecommons.org/licenses/by/2.5/deed.fr}{CC-by}}}\xspace}
\renewcommand{\ccbysa}{\textsl{\textsc{\href{https://creativecommons.org/licenses/by-sa/3.0/deed.fr}{CC-by-sa}}}\xspace}
\newcommand{\ccbysatwozerofr}{\textsl{\textsc{\href{https://creativecommons.org/licenses/by-sa/2.0/fr/deed.en}{CC-by-sa-2.0-fr}}}\xspace}
\newcommand{\ccbynctwofive}{\textsl{\textsc{\href{https://creativecommons.org/licenses/by-nc/2.5/}{CC-by-nc-2.5}}}\xspace}
\newcommand{\lal}{\textit{\href{http://artlibre.org/licence/lal/}{Licence Art Libre}}\xspace}
\newcommand{\gfdl}{\textsl{\textsc{\href{https://www.gnu.org/licenses/old-licenses/fdl-1.2.html}{gfdl1.2}}}\xspace}
\newcommand{\myccbysa}{\textsc{\href{https://creativecommons.org/licenses/by-sa/3.0/deed.fr}{\textcolor{black}{CC-by-sa}}}\xspace}
\newcommand{\myccbysaen}{\textsc{\href{https://creativecommons.org/licenses/by-sa/3.0/}{\textcolor{black}{CC-by-sa}}}\xspace}
541 542 543 544
\newcommand{\thermoariadacapo}{\href{https://thermodynamique.fr}{\textcolor{black}{thermodynamique.fr}}}
\newcommand{\httpthermoariadacapo}{\href{https://thermodynamique.fr}{\textcolor{black}{https://thermodynamique.fr/}}}
\newcommand{\olivier}{\href{https://ariadacapo.net}{\textcolor{black}{Olivier Cleynen}}}
\newcommand{\oc}{\href{https://ariadacapo.net}{\textcolor{black}{\textsc{o.c.}}}}
545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579


% Macro that creates a wikipedia link.
% Syntax : 	\wf{Article en Français} 	or \wfd{Article}{texte différent du nom de l’article}
% Syntax : 	\we{English article} 		or \wed{Article}{some text different from the article title}
% Code structure: \wikipedialinkfr → \urlwhitespacereplace → \wf
\usepackage{xstring}			% package for link macro to work

\newcommand{\wikipedialinkfr}[1]{https://fr.wikipedia.org/wiki/#1} % Makes proper URL only if fed text with underscores
\newcommand{\wikipedialinken}[1]{https://en.wikipedia.org/wiki/#1}

\newcommand{\urlwhitespacereplace}[1]{\StrSubstitute{#1}{ }{_}[\wpLink]} % sustitute spaces for underscores

\newcommand{\wf}[1]{\urlwhitespacereplace{#1}\href{\wikipedialinkfr{\wpLink}}{#1}}
\newcommand{\wfd}[2]{\urlwhitespacereplace{#1}\href{\wikipedialinkfr{\wpLink}}{#2}}

\newcommand{\we}[1]{\urlwhitespacereplace{#1}\href{\wikipedialinken{\wpLink}}{#1}}
\newcommand{\wed}[2]{\urlwhitespacereplace{#1}\href{\wikipedialinken{\wpLink}}{#2}}

% Link to Commons user page
\newcommand{\wcu}[1]{\href{https://commons.wikimedia.org/wiki/user:#1}{l’utilisateur$\cdot$rice Commons #1}}
\newcommand{\wcun}[2]{\href{https://commons.wikimedia.org/wiki/user:#1}{#2}}
\newcommand{\wcfile}[2]{\href{https://commons.wikimedia.org/wiki/file:#1}{#2}}

% Link to Wikipedia en user page
\newcommand{\weu}[1]{\href{https://en.wikipedia.org/wiki/User:#1}{l’utilisateur$\cdot$rice Wikipedia #1}}
\newcommand{\weun}[2]{\href{https://en.wikipedia.org/wiki/User:#1}{#2}}

% Link to Wikipedia de user page
\newcommand{\wdu}[1]{\href{https://de.wikipedia.org/wiki/Benutzerin:#1}{l’utilisateur$\cdot$rice Wikipedia #1}}
\newcommand{\wdun}[2]{\href{https://de.wikipedia.org/wiki/Benutzerin:#1}{#2}}

% Link to Flickr user page. Doesn’t seem to work anymore since user URLs do not match user names anymore.
\newcommand{\flickruser}[1]{\href{https://secure.flickr.com/people/#1}{l’utilisateur$\cdot$rice Flickr #1}}
\newcommand{\flickrname}[2]{\href{https://secure.flickr.com/people/#1}{#2}}
580
\newcommand{\flickrcodename}[2]{\href{https://secure.flickr.com/people/#1}{l’utilisateur$\cdot$rice Flickr #2}}
581 582 583 584 585 586 587
\newcommand{\flickrfile}[2]{\href{https://www.flickr.com/photos/#1}{#2}}


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Packages that all want to be loaded last to avoid conflicts

\usepackage{hyperref}
588 589 590 591 592 593 594

\newcommand\bookkeywords{framabook, thermodynamique, thermodynamique macroscopique, thermo, énergie, chaleur, travail, puissance, cycles moteur, réfrigérateurs, turbomachines, centrales à vapeur, premier principe, deuxième principe, lois de la thermodynamique}

\usepackage[numbered]{bookmark} % Configures table of contents in PDF bookmarks
\hypersetup{%
	pdftex,
	pdfauthor={Olivier Cleynen},
595
	pdftitle={Framabook Thermodynamique de l'ingénieur - cours et exercices corrigés | Olivier Cleynen | thermodynamique.fr},
596 597 598 599 600 601 602 603 604 605 606 607 608 609
	pdfsubject={Thermodynamique de l'ingénieur},
	pdfkeywords={\bookkeywords}
	pdfnewwindow=false,	% do not make links pop in new window (who likes that???)
	colorlinks=true,		% false: framed links (why???); true: colored links
	linkcolor=internallinkcolor,	% color for internal → links
	citecolor=black,
	filecolor=black,
	urlcolor=externallinkcolor,	% color for external ↑ links
	bookmarks=true,	% Show bookmarks bar (contains index)
	unicode=false,		% Help with non-Latin characters in the PDF readers’ bookmarks
	pdftoolbar=true,	% Show the PDF reader’s toolbar
	pdfmenubar=true,	% show the PDF reader’s menu
}

610 611

\usepackage[all]{hypcap}		% so links to figures point to the image, not the caption. Must be loaded after hyperref. Broken when caption{} is redefined. Needs a paragraph before it’s called!