summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/doc/support/latexindent/latexindent.tex
blob: 22aecf1b78df4f03c0e9b34c79fa6bd421396c2b (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
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
208
209
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
318
319
320
321
322
323
324
325
326
327
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
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
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
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
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
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
% arara: pdflatex: {shell: yes}
% arara: makeindex: {style: latexindent.ist}
% arara: bibtex
% arara: pdflatex: {shell: yes} if changed (toFile('latexindent.aux')) || changed (toFile('latexindent.ind')) 
% arara: pdflatex: {shell: yes} if changed (toFile('latexindent.aux')) 
% arara: pdflatex: {shell: yes} if changed (toFile('latexindent.aux')) 
\documentclass[10pt]{article}
%   This program is free software: you can redistribute it and/or modify
%   it under the terms of the GNU General Public License as published by
%   the Free Software Foundation, either version 3 of the License, or
%   (at your option) any later version.
%
%   This program is distributed in the hope that it will be useful,
%   but WITHOUT ANY WARRANTY; without even the implied warranty of
%   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
%   GNU General Public License for more details.
%
%   See <http://www.gnu.org/licenses/>.
\usepackage[left=4.5cm,right=2.5cm,showframe=false,
	top=2cm,bottom=1.5cm,marginparsep=2cm]{geometry}                      % page setup
\usepackage{lmodern}
\usepackage{parskip}                                 % paragraph skips
\usepackage{booktabs}                                % beautiful tables
\usepackage{listings}                                % nice verbatim environments
\usepackage{titlesec}                                % customize headings
\usepackage{titletoc}                                % customize headings
\usepackage{multicol}
\usepackage{changepage}                              % adjust width of page
\usepackage{fancyhdr}                                % headers & footers
\usepackage{wrapfig}
\usepackage{fontawesome}
\usepackage[sc,format=hang,font=small]{caption}      % captions
\usepackage[backend=bibtex]{biblatex}                % bibliography
\usepackage{tcolorbox}                                % framed environments
\usepackage{tikz}
\usepackage{xparse}
\usepackage[charter]{mathdesign}                     % changes font
\usepackage[expansion=false,kerning=true]{microtype} % better kerning
\usepackage{enumitem}                                % custom lists
\usepackage{longtable}
\usepackage{array}
\usepackage{totalcount}
\usepackage{standalone}
% setup gitinfo2, as in the manual, details just above begin{document}
\usepackage[mark,grumpy]{gitinfo2}
% tikz, tcolorbox libraries
\usetikzlibrary{positioning}
\usetikzlibrary{decorations.pathmorphing}
\usetikzlibrary{decorations,shapes}
\usepackage{varioref}                                % the documentation library from tcolorbox loads hyperref
\tcbuselibrary{breakable,minted,xparse,documentation,hooks,raster}
\hypersetup{
	pdfauthor={Chris Hughes},
	pdftitle={latexindent.pl package},
	pdfkeywords={perl;beautify;indentation},
	bookmarksnumbered,
	bookmarksopen,
	linktocpage,
	colorlinks=true,
	linkcolor=blue,
	citecolor=black,
}
\usepackage{cleveref}

% create my own star style, for re-use at various points
\tikzset{cmhstar/.style={star,star point ratio=2.25,fill=cmhgold,draw=orange,}}

% shortcut command for displaying star in documentation
\newcommand{\stardemo}[1][]{\begin{tikzpicture}
	\node at (10:.1cm)[very thin,cmhstar,scale=0.25,rotate=20,#1]{};
	\node at (120:.1cm)[very thin,cmhstar,scale=0.15,rotate=-10,#1]{};
	\node at (235:.1cm)[very thin,cmhstar,scale=0.2,rotate=-20,#1]{};
	\end{tikzpicture}}

% totalcount
\DeclareTotalCounter{lstlisting}

% customise the \tcbdocnew command
\tcbset{doclang/new={{\bfseries\color{green!50!black}N\normalfont\color{black}}}}
\tcbset{doclang/updated={{\bfseries\color{green!50!black}U\normalfont\color{black}}}}
\tcbset{doc marginnote={width=1.6cm}}
\NewDocumentCommand{\announce}{ s m s m }{%
	\IfBooleanTF{#1}%
	{% \announce*
		\tcbdocmarginnote[overlay={\node at ([yshift=0mm,xshift=1mm]frame.north east) {\stardemo}; }]{%
			\IfBooleanTF{#3}%
			{% \announce*{date}*[text] means *updated* as of <date>
				\tcbdocupdated{#2}%
			}%
			{% \announce*{date}[text] means *new* as of <date>
				\tcbdocnew{#2}%
			}%
		}%
		\IfBooleanTF{#3}%
		{%
			\addcontentsline{new}{cmhtitle}{#4 (U)}%
		}%
		{%
			\addcontentsline{new}{cmhtitle}{#4 (N)}%
		}%
	}%
	{% \announce
		\tcbdocmarginnote{%
			\IfBooleanTF{#3}%
			{% \announce{date}*[text] means *updated* as of <date>
				\tcbdocupdated{#2}%
			}%
			{% \announce{date}[text] means *new* as of <date>
				\tcbdocnew{#2}%
			}%
		}%
	}}

\reversemarginpar
% bibliographies
\addbibresource{latex-indent}
\addbibresource{contributors}

% http://tex.stackexchange.com/questions/122135/how-to-add-a-png-icon-on-the-right-side-of-a-tcolorbox-title
\newtcolorbox{warning}{parbox=false,breakable,enhanced,arc=0mm,colback=red!5,colframe=red,leftrule=12mm,%
	overlay={\node[anchor=north west,outer sep=2pt] at (frame.north west) {\includegraphics[width=8mm]{warning}}; }
}

\definecolor{harvestgold}{cmyk}{0.00, 0.05, 0.51, 0.07}  %EDE275
\definecolor{cmhgold}{cmyk}{0,0.178,0.909,0.008}         %FDD017
\colorlet{cmhgray}{gray!30!white}

\makeatletter
\tcbset{
	addtolol/.style={list entry={\kvtcb@title},add to list={lol}{lstlisting}},
	addtololstar/.style={list entry={\kvtcb@title},add to list={lol}{lstlistingstar}},
	cmhlistings/.style={
			%	width=\linewidth,
			%breakable,
			colback=blue!5!white,
			colframe=white!25!black,colback=white,
			top=0cm,
			bottom=0cm,
			left=0mm,
			listing only,
			center title,
			listing engine=minted,
			minted style=colorful,
			minted options={obeytabs=true,showtabs=true,tabsize=4,showspaces=true},
			boxrule=0pt,
			toprule=1pt,bottomrule=1pt,
			titlerule=1pt,
			colframe=white!40!black,
			colback=white,
			sharp corners,
			colbacktitle=white!75!black
		},
	yaml-TCB/.style={
			listing only,
			listing engine=listings,
			left=0cm,
			boxrule=0pt,
			sharp corners,
			center title,
			colbacktitle=white!75!blue,
			colframe=white!25!blue,
			colback=white!90!blue,
			toprule=2pt,
			titlerule=2pt,
		},
	MLB-TCB/.style={
			yaml-TCB,
			center title,
			colframe=cmhgold,
			colbacktitle=harvestgold,
			colback=white!60!cmhgold,
			width=0.9\linewidth,
			before=\centering,
			enhanced,
			overlay={\node[anchor=north east,outer sep=2pt,draw=cmhgold,very thick,double,fill=harvestgold,font =\small] at ([yshift=-3mm]frame.north east) {\texttt{-m}}; }
		},
	replace-TCB/.style={
			yaml-TCB,
			center title,
			colbacktitle=white!75!green,
			colframe=white!25!green,
			colback=white!90!green,
			width=0.9\linewidth,
			before=\centering,
			enhanced,
			overlay={\node[anchor=north east,outer sep=2pt,draw=white!25!green,very thick,circle,fill=white!75!green,font =\small] at ([yshift=-3mm]frame.north east) {\texttt{-r}}; }
		},
	yaml-obsolete/.style={
			listing only,
			listing engine=listings,
			left=0cm,
			boxrule=0pt,
			sharp corners,
			center title,
			toprule=2pt,
			titlerule=2pt,
			colframe=white!25!red,
			colbacktitle=white!75!red,
			colback=white!90!red,
		},
	new-to-this-version/.style={
			enhanced,
			overlay app={\node at ([yshift=0mm,xshift=0mm]frame.north east) {\stardemo[scale=1.2]}; },
			addtololstar,
		},
}

\DeclareTCBListing[use counter=lstlisting]{cmhlistings}{s O{} m m}{%
	cmhlistings,
	IfBooleanTF={#1}{new-to-this-version}{addtolol},
	center title,
	title={\color{black}{\scshape Listing \thetcbcounter}: ~#3},label={#4},
	listing engine=listings,
	listing options={#2},
}

\DeclareDocumentEnvironment{cmhtcbraster}{O{}}{\begin{tcbraster}[
		new-to-this-version/.style={
				enhanced,
				overlay app={\node[anchor=south east] at ([yshift=-3mm,xshift=3mm]frame.north east) {\stardemo[scale=1.2]}; },
				addtololstar,
			},
		raster valign=top,raster columns=2,#1]}{\end{tcbraster}}

% \cmhlistingsfromfile
%                   *    no star: not new, star: new
%                   [ listing/minted options ]
%                   *    no star: uses minted library, star: uses listings library star: 
%                   {<name of listing file>}
%                   [<options for tcolorbox>]
%                   {<title>}
%                   {<label>}
%
% for example,
%   \cmhlistingsfromfile*[listing options]...  uses listings library and is NEW
%   \cmhlistingsfromfile[listing options]...   uses listings library
%   \cmhlistingsfromfile[listing options]*...  uses minted library
%   \cmhlistingsfromfile*[listing options]*... uses minted library and is NEW
\DeclareTCBInputListing[use counter=lstlisting]{\cmhlistingsfromfile}{s O{} s m O{} m m}{%
	cmhlistings,
	listing file={#4},
	IfBooleanTF={#3}{listing options={style=tcblatex,showspaces=false,#2}}{minted options={obeytabs=true,showtabs=false,tabsize=4,showspaces=false,#2}},
	title={\color{black}{\scshape Listing \thetcbcounter}: ~#6},label={#7},
	#5,
	IfBooleanTF={#1}{new-to-this-version}{addtolol},
}

\makeatletter
\@tempswafalse
\def\@tempa{draft}
\@for\next:=\@classoptionslist\do
{\ifx\next\@tempa\@tempswatrue\fi}
\if@tempswa % draft option is active
	\RenewDocumentCommand{\cmhlistingsfromfile}{s O{} s m O{} m m}{\captionof{lstlisting}{#6}\label{#7}}
	\renewcommand{\stardemo}[1][]{$\star$}
\fi

% command shell
\newtcblisting{commandshell}{colback=black,colupper=white,colframe=yellow!75!black,
	listing only,listing options={style=tcblatex,language=sh,
			morekeywords={latexindent,pl},
			keywordstyle=\color{blue!35!white}\bfseries,
		},
	listing engine=listings,
	left=0cm,
	every listing line={\textcolor{red}{\small\ttfamily\fontseries{b}\selectfont cmh:$\sim$\$ }}}

% dosprompt
\newtcblisting{dosprompt}{
	colback=black,
	colupper=white,
	colframe=yellow!75!black,
	listing only,
	listing options={
			language=command.com,
			morekeywords={latexindent,pl},
			keywordstyle=\color{blue!35!white}\bfseries,
			basicstyle=\small\color{white}\ttfamily
		},
	listing engine=listings,
	left=0cm,
	every listing line={\textcolor{white}{\small\ttfamily\fontseries{b}\selectfont C:\textbackslash Users\textbackslash cmh$>$}}}

\lstset{%
	basicstyle=\small\ttfamily,language={[LaTeX]TeX},
	numberstyle=\ttfamily%\small,
	breaklines=true,
	keywordstyle=\color{blue},                    % keywords
	commentstyle=\color{purple},    % comments
	tabsize=3,
}%
\DeclareTCBListing[use counter=lstlisting]{yaml}{O{} m O{} m}{
	yaml-TCB,
	listing options={
			style=tcblatex,
			numbers=none,
			numberstyle=\color{red},
			#1,
		},
	title={\color{black}{\scshape Listing \thetcbcounter}: ~#2},label={#4},
	#3,
}

\lstdefinestyle{yaml-LST}{
	style=tcblatex,
	numbers=none,
	numberstyle=\color{red},
}

\lstdefinestyle{demo}{
	numbers=none,
	linewidth=1.25\textwidth,
	columns=fullflexible,
}

\lstdefinestyle{fileExtensionPreference}{
	style=yaml-LST,
	firstnumber=41,linerange={41-45},
	numbers=left,
}

\lstdefinestyle{logFilePreferences}{
	style=yaml-LST,
	firstnumber=85,linerange={85-91},
	numbers=left,
}

\lstdefinestyle{verbatimEnvironments}{
	style=yaml-LST,
	firstnumber=95,linerange={95-98},
	numbers=left,
}

\lstdefinestyle{verbatimCommands}{
	style=yaml-LST,
	firstnumber=101,linerange={101-103},
	numbers=left,
}

\lstdefinestyle{noIndentBlock}{
	style=yaml-LST,
	firstnumber=108,linerange={108-110},
	numbers=left,
}

\lstdefinestyle{removeTrailingWhitespace}{
	style=yaml-LST,
	firstnumber=113,linerange={113-115},
	numbers=left,
}

\lstdefinestyle{fileContentsEnvironments}{
	style=yaml-LST,
	firstnumber=119,linerange={119-121},
	numbers=left,
}

\lstdefinestyle{lookForPreamble}{
	style=yaml-LST,
	firstnumber=127,linerange={127-131},
	numbers=left,
}

\lstdefinestyle{lookForAlignDelims}{
	style=yaml-LST,
	firstnumber=144,linerange={144-160},
	numbers=left,
}

\lstdefinestyle{indentAfterItems}{
	style=yaml-LST,
	firstnumber=217,linerange={217-221},
	numbers=left,
}

\lstdefinestyle{itemNames}{
	style=yaml-LST,
	firstnumber=227,linerange={227-229},
	numbers=left,
}

\lstdefinestyle{specialBeginEnd}{
	style=yaml-LST,
	firstnumber=233,linerange={233-246},
	numbers=left,
}

\lstdefinestyle{indentAfterHeadings}{
	style=yaml-LST,
	firstnumber=256,linerange={256-265},
	numbers=left,
}

\lstdefinestyle{noAdditionalIndentGlobalEnv}{
	style=yaml-LST,
	firstnumber=314,linerange={314-315},
	numbers=left,
}

\lstdefinestyle{noAdditionalIndentGlobal}{
	style=yaml-LST,
	firstnumber=314,linerange={314-326},
	numbers=left,
}

\lstdefinestyle{indentRulesGlobalEnv}{
	style=yaml-LST,
	firstnumber=330,linerange={330-331},
	numbers=left,
}

\lstdefinestyle{indentRulesGlobal}{
	style=yaml-LST,
	firstnumber=330,linerange={330-342},
	numbers=left,
}

\lstdefinestyle{commandCodeBlocks}{
	style=yaml-LST,
	firstnumber=345,linerange={345-360},
	numbers=left,
}

\lstdefinestyle{modifylinebreaks}{
	style=yaml-LST,
	firstnumber=472,linerange={472-474},
	numbers=left,
}

\lstdefinestyle{textWrapOptions}{
	style=yaml-LST,
	firstnumber=499,linerange={499-500},
	numbers=left,
}

\lstdefinestyle{textWrapOptionsAll}{
	style=yaml-LST,
	firstnumber=499,linerange={499-515},
	numbers=left,
}

\lstdefinestyle{removeParagraphLineBreaks}{
	style=yaml-LST,
	firstnumber=516,linerange={516-530},
	numbers=left,
}

\lstdefinestyle{paragraphsStopAt}{
	style=yaml-LST,
	firstnumber=531,linerange={531-540},
	numbers=left,
}

\lstdefinestyle{oneSentencePerLine}{
	style=yaml-LST,
	firstnumber=475,linerange={475-498},
	numbers=left,
}

\lstdefinestyle{sentencesFollow}{
	style=yaml-LST,
	firstnumber=480,linerange={480-488},
	numbers=left,
}

\lstdefinestyle{sentencesBeginWith}{
	style=yaml-LST,
	firstnumber=489,linerange={489-492},
	numbers=left,
}

\lstdefinestyle{sentencesEndWith}{
	style=yaml-LST,
	firstnumber=493,linerange={493-498},
	numbers=left,
}

\lstdefinestyle{modifylinebreaksEnv}{
	style=yaml-LST,
	firstnumber=541,linerange={541-550},
	numbers=left,
}

\lstdefinestyle{replacements}{
	style=yaml-LST,
	firstnumber=602,linerange={602-610},
	numbers=left,
}

\lstdefinestyle{fineTuning}{
	style=yaml-LST,
	firstnumber=613,linerange={613-634},
	numbers=left,
}

% stars around contributors
\pgfdeclaredecoration{stars}{initial}{
	\state{initial}[width=15pt]
	{
		\pgfmathparse{round(rnd*100)}
		\pgfsetfillcolor{yellow!\pgfmathresult!orange}
		\pgfsetstrokecolor{yellow!\pgfmathresult!red}
		\pgfnode{star}{center}{}{}{\pgfusepath{stroke,fill}}
	}
	\state{final}
	{
		\pgfpathmoveto{\pgfpointdecoratedpathlast}
	}
}

\newtcolorbox{stars}{%
	enhanced jigsaw,
	breakable, % allow page breaks
	left=0cm,
	top=0cm,
	before skip=0.2cm,
	boxsep=0cm,
	frame style={draw=none,fill=none}, % hide the default frame
	colback=white,
	overlay={
			\draw[inner sep=0,minimum size=rnd*15pt+2pt]
			decorate[decoration={stars,segment length=2cm}] {
					decorate[decoration={zigzag,segment length=2cm,amplitude=0.3cm}] {
							([xshift=-.5cm,yshift=0.1cm]frame.south west) --  ([xshift=-.5cm,yshift=0.4cm]frame.north west)
						}};
			\draw[inner sep=0,minimum size=rnd*15pt+2pt]
			decorate[decoration={stars,segment length=2cm}] {
					decorate[decoration={zigzag,segment length=2cm,amplitude=0.3cm}] {
							([xshift=.75cm,yshift=0.1cm]frame.south east) --  ([xshift=.75cm,yshift=0.6cm]frame.north east)
						}};
			\node[anchor=north west,outer sep=2pt,opacity=0.25] at ([xshift=-4.25cm]frame.north west) {\resizebox{3cm}{!}{\faGithub}};
		},
	% paragraph skips obeyed within tcolorbox
	parbox=false,
}

\newtcolorbox[auto counter]{example}{breakable,
	enhanced jigsaw,
	before skip=6pt,after skip=6pt,
	frame hidden,
	title={\llap{Example~\thetcbcounter\hspace{3mm}}},
	fonttitle=\bfseries,
	coltitle=black,
	attach title to upper,
	grow to left by=5mm,
	top=3mm,
	overlay unbroken={%
			\draw[thick,cmhgray] ([xshift=3mm]interior.north east)--([xshift=3mm]interior.south east);
			\path [fill=cmhgray] ([xshift=3mm]interior.north east) circle (.5mm);
			\path [fill=cmhgray] ([xshift=3mm]interior.south east) circle (1mm);
		},
	overlay first={%
			\draw[thick,cmhgray] ([xshift=3mm]interior.north east)--([xshift=3mm]interior.south east);
			\path [fill=cmhgray] ([xshift=3mm]interior.north east) circle (.5mm);
			%\path [draw=cmhgray,fill=white] ([xshift=3mm]interior.south east) circle (.5mm);
		},
	overlay last={%
			\draw[thick,cmhgray] ([xshift=3mm]interior.north east)--([xshift=3mm]interior.south east);
			%\path [fill=white,draw=cmhgray] ([xshift=3mm]interior.north east) circle (.5mm);
			\path [fill=cmhgray] ([xshift=3mm]interior.south east) circle (1mm);
		},
	parbox=false,
}

% copied from /usr/local/texlive/2013/texmf-dist/tex/latex/biblatex/bbx/numeric.bbx
% the only modification is the \stars and \endstars
\defbibenvironment{specialbib}
{\stars\list
	{\printtext[labelnumberwidth]{%
			\printfield{prefixnumber}%
			\printfield{labelnumber}}}
	{\setlength{\labelwidth}{\labelnumberwidth}%
		\setlength{\leftmargin}{\labelwidth}%
		\setlength{\labelsep}{\biblabelsep}%
		\addtolength{\leftmargin}{\labelsep}%
		\setlength{\itemsep}{\bibitemsep}%
		\setlength{\parsep}{\bibparsep}}%
	\renewcommand*{\makelabel}[1]{\hss##1}}
{\endlist\endstars}
{\item}

\newtcbox{yamltitlebox}[1][]{colframe=black!50!white,boxrule=.5pt,sharp corners,#1}

\newcommand{\flagbox}[1]{%
	\par
	\makebox[30pt][l]{%
		\hspace{-1cm}%
		\ttfamily\fontseries{b}\selectfont #1
	}%
}

\NewDocumentCommand{\yamltitle}{O{} m s m}{%
	\par
	\makebox[30pt][l]{%
		\hspace{-2cm}%
		\yamltitlebox[#1]{%
			{\ttfamily\fontseries{b}\selectfont{\color{blue!80!white}#2}}: %
			\IfBooleanTF{#3}
			{$\langle$\itshape #4$\rangle$}
			{{\bfseries #4}}
		}}
	\par\nobreak%
}

\newcommand{\fixthis}[1]
{%
	\marginpar{\huge \color{red} \framebox{FIX}}%
	\typeout{FIXTHIS: p\thepage : #1^^J}%
}
% custom section
\titleformat{\section}
{\normalfont\Large\bfseries}
{\llap{\thesection\hskip.5cm}}
{0pt}
{}

\newcommand*\ruleline[1]{%
	\par\noindent\raisebox{.8ex}{\makebox[\linewidth]{\hrulefill\hspace{1ex}\raisebox{-1.8ex}{#1}\hspace{1ex}\hrulefill}}}

\newcommand{\imagetouse}{logo-bw}

\titleformat% Formatting the header
{\section} % command
[block] % shape - Only managed to get it working with block
{\normalfont\bfseries\huge} % format - Change here as needed
{\centering {\scshape Section \thesection}\\} % the section
{0pt} % sep
{\centering \ruleline{\includegraphics{\imagetouse}}\\ % The horizontal rule
	\centering} % And the actual title

% custom subsection
\titleformat{\subsection}
{\normalfont\bfseries}
{\llap{\thesubsection\hskip.5cm}}
{0pt}
{}
% custom subsubsection
\titleformat{\subsubsection}
{\normalfont\bfseries}
{\llap{\thesubsubsection\hskip.5cm}}
{0pt}
{}

\titlespacing\section{0pt}{12pt plus 4pt minus 2pt}{34pt plus 2pt minus 2pt}
\titlespacing\subsection{0pt}{12pt plus 4pt minus 2pt}{4pt plus 2pt minus 2pt}
\titlespacing\subsubsection{0pt}{12pt plus 4pt minus 2pt}{4pt plus 2pt minus 2pt}

% list of listings
\contentsuse{lstlisting}{lol}
\titleclass{\lstlistingstar}{straight}[\section]
\titleformat{\lstlistingstar}{}{}{}{}
\titlecontents{lstlistingstar}[2em]
  {\addvspace{0.25pc}}
  {}
  {\llap{\stardemo}\thecontentslabel}
  {\titlerule*[0.5em]{$\cdot$}\contentspage}
  []
\titlecontents{lstlisting}[2em]
  {\addvspace{0.25pc}}
  {\thecontentslabel}
  {\thecontentslabel}
  {\titlerule*[0.5em]{$\cdot$}\contentspage}
  []
\AtBeginDocument{\addtocontents{lol}{\protect\begin{widepage}\protect\begin{multicols}{2}}}

% cleveref settings
\crefname{table}{Table}{Tables}
\Crefname{table}{Table}{Tables}
\crefname{figure}{Figure}{Figures}
\Crefname{figure}{Figure}{Figures}
\crefname{section}{Section}{Sections}
\Crefname{section}{Section}{Sections}
\crefname{listing}{Listing}{Listings}
\Crefname{listing}{Listing}{Listings}

% headers and footers
\fancyhf{} % delete current header and footer
\fancyhead[R]{\bfseries\thepage%
	\tikz[remember picture,overlay] {
		\node at (1,0){\includegraphics{logo-bw}}; }
}
\fancyhead[L]{\rightmark}
\fancyheadoffset[L]{3cm}
\pagestyle{fancy}

% renew plain style
\fancypagestyle{plain}{%
	\fancyhf{} % clear all header and footer fields
	\renewcommand{\headrulewidth}{0pt}
	\renewcommand{\footrulewidth}{0pt}}

% widepage environment
\newenvironment{widepage}{\begin{adjustwidth}{-3cm}{0cm}}{\end{adjustwidth}}

% symbols for the m switch
\newcommand{\BeginStartsOnOwnLine}{\color{red}\spadesuit}
\newcommand{\BodyStartsOnOwnLine}{\color{red}\heartsuit}
\newcommand{\EndStartsOnOwnLine}{\color{red}\diamondsuit}
\newcommand{\EndFinishesWithLineBreak}{\color{red}\clubsuit}
\newcommand{\ElseStartsOnOwnLine}{\color{red}\bigstar}
\newcommand{\ElseFinishesWithLineBreak}{\color{red}\square}
\newcommand{\OrStartsOnOwnLine}{\color{red}\blacktriangle}
\newcommand{\OrFinishesWithLineBreak}{\color{red}\blacktriangledown}
\newcommand{\EqualsStartsOnOwnLine}{\color{red}\bullet}

% table rules
\setlength\heavyrulewidth{0.25ex}
% gitinfo2 settings
\renewcommand{\gitMark}{\gitBranch\,@\,\gitAbbrevHash{}\,\textbullet{}\,\gitAuthorDate\,\textbullet{}\faGithub\,\textbullet{}\gitRel}

% setting up gitinfo2:
%   copy the file post-xxx-sample.txt from http://mirror.ctan.org/macros/latex/contrib/gitinfo2
%   and put it in .git/hooks/post-checkout
% then
%   cd .git/hooks
%   chmod g+x post-checkout
%   chmod +x post-checkout
%   cp post-checkout post-commit
%   cp post-checkout post-merge
%   cd ../..
%   git checkout master
%   git checkout develop
%   ls .git
% and you should see gitHeadInfo.gin
% 
% Make sure that the 'V' is included in the below!
%
% RELTAG=$(git describe --tags --long --always --dirty='-*' --match 'V[0-9]*.*' 2>/dev/null)

% http://tex.stackexchange.com/questions/233843/textasteriskcentered-invisible-with-garamondmathdesign
% remove the definition of \textasteriskcentered for TS1 encoding
\UndeclareTextCommand{\textasteriskcentered}{TS1}
% reinstate a default encoding
\DeclareTextSymbolDefault{\textasteriskcentered}{OT1}
% suitably define the command
\DeclareTextCommand{\textasteriskcentered}{OT1}{\raisebox{-.7ex}[1ex][0pt]{*}}

% new features list
\newcommand{\listOfNewFeatures}{\setcounter{tocdepth}{4}\@starttoc{new}}
\contentsuse{cmhtitle}{new}
% toc settings
\titleclass{\cmhtitle}{straight}[\subsection]
\titleformat{\cmhtitle}{}{}{}{}
\titlecontents{cmhtitle}% <paragaph>
  [2cm]% <left>
  {\small\itshape}% <above-code>
  {}% <numbered-entry-format>; you could also use {\thecontentslabel. } to show the numbers
  {}% <numberless-entry-format>
  {\titlerule*[0.5em]{$\cdot$}\contentspage}

\setcounter{secnumdepth}{5}
\makeindex
\begin{document}
\renewcommand*{\thefootnote}{\arabic{footnote}}
\input{title.tex}
\tableofcontents
{\small\lstlistoflistings}
% start sections on new page
\newcommand{\sectionbreak}{\clearpage\thispagestyle{plain}}
 \input{sec-introduction}
 \input{sec-demonstration}
 \input{sec-how-to-use}
 \input{sec-indent-config-and-settings.tex}
 \input{sec-default-user-local}
 \input{subsec-noAdditionalIndent-indentRules}
 \input{subsubsec-environments-and-their-arguments}
 \input{subsubsec-environments-with-items}
 \input{subsubsec-commands-with-arguments}
 \input{subsubsec-ifelsefi}
 \input{subsubsec-special}
 \input{subsubsec-headings}
 \input{subsubsec-no-add-remaining-code-blocks}
 \stopcontents[noAdditionalIndent]
 \input{subsec-commands-and-their-options}
 \input{sec-the-m-switch}
 \stopcontents[the-m-switch]
 \input{subsec-partnering-poly-switches}
 \input{subsec-conflicting-poly-switches}
 \input{sec-replacements}
 \input{sec-fine-tuning}
 \input{sec-conclusions-know-limitations}
 \input{references}
 \input{appendices}
 \addtocontents{lol}{\protect\end{multicols}\protect\end{widepage}}
 \printindex
\end{document}