Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- documentclass[11pt]{book}
- usepackage{lmodern}
- usepackage[T1]{fontenc}
- usepackage{xcolor}
- usepackage{amsmath}
- usepackage{amsbsy}
- usepackage{amssymb}
- usepackage{bm}
- usepackage{fixmath}
- usepackage{titlesec}
- titleformat{subsection}[runin]{normalfontbfseries}{hspace{10mm}arabic{subsection}.}{1mm}{}{}
- % titleformat*{chapter}{bfseriesboldmath}%<<==BERNARD This causes an error
- titleformat*{section}{bfseriesboldmath}%<<==BERNARD This shrinks titles
- usepackage[detect-all]{siunitx}%<<<<<<<=======BERNARD
- usepackage[dotinlabels]{titletoc}
- titlecontents{chapter}[6pc]{addvspace{1pc}bfseriesfilright}{contentslabel[chaptername thecontentslabel]{6pc}}{}{hfillcontentspage}[addvspace{2pt}]%
- newcommandxquad{hspace*{0.4em plus .2em minus .2em}}%
- titlecontents*{p-section}[0pt]{filrightsmall}{}{}{, thecontentspage}[xquadtextbulletxquad][.]%
- newcommand{ChapterToc}{startcontents[chapters]printcontents[chapters]{p-}{1}{}vspace{10mm}}%
- setcounter{tocdepth}{1}% <- only parts, chapters and sections in tocs hspace{10mm}
- usepackage{tcolorbox}%
- tcbuselibrary{%Begin load libraries for tcolorbox
- xparse,%
- }%End load libraries for tcolorbox
- usepackage{makeidx} %The imakeindex does not work
- makeindex
- usepackage[hyperfootnotes=false]{hyperref}
- %=============== Begin the Heiko Oberdiek ``quick and dirty hack'' which loads showidx
- makeatletter
- ifHy@hyperindex
- defHyInd@ParenLeft{(}%
- % Hook in HyInd@@wrindex
- letHyInd@showidx@empty
- % Hook in HyInd@@wrindex for package showidx
- defHyInd@showidx#1{%
- @showidx{#1}%
- if@nobreak
- ifvmode
- nobrak
- fi
- fi
- }%
- % Load package showidx
- letsiOrg@makeindexmakeindex
- letsiOrg@@index@index
- letsiOrg@@wrindex@wrindex
- letsiOrg@indexindex
- RequirePackage{showidx}
- letmakeindexsiOrg@makeindex
- let@indexsiOrg@@index
- let@wrindexsiOrg@@wrindex
- letindexsiOrg@index
- % rest of hyperref part
- @ifpackageloaded{multind}{%
- letHyInd@org@wrindex@wrindex
- def@wrindex#1#2{HyInd@@wrindex{#1}#2||\}%
- defHyInd@@wrindex#1#2|#3|#4\{%
- ifx\#3\%
- HyInd@org@wrindex{#1}{#2|hyperpage}%
- else
- defHy@temp@A{#3}%
- ifxHy@temp@AHyInd@ParenLeft
- HyInd@org@wrindex{#1}{#2|#3hyperpage}%
- else
- HyInd@org@wrindex{#1}{#2|#3}%
- fi
- fi
- }%
- }{%
- def@wrindex#1{@@wrindex#1||\}
- def@@wrindex#1|#2|#3\{%
- ifx\#2\%
- protected@write@indexfile{}{%
- stringindexentry{#1|hyperpage}{thepage}%
- }%
- else
- defHy@temp@A{#2}%
- ifxHy@temp@AHyInd@ParenLeft
- protected@write@indexfile{}{%
- stringindexentry{#1|#2hyperpage}{thepage}%
- }%
- else
- protected@write@indexfile{}{%
- stringindexentry{#1|#2}{thepage}%
- }%
- fi
- fi
- endgroup
- HyInd@showidx{#1}%
- @esphack
- }%
- }%
- fi
- makeatother
- %=============== End the Heiko Oberdiek ``quick and dirty hack'' which loads showidx
- hypersetup{%begin colors
- colorlinks,
- linkcolor={red!50!black},
- }%end colors
- usepackage{cleveref}% should be the last package
- Crefname{subsection}{Subsection}{Subsections}
- newcommand{titleref}{nameref}%displays TITLE of refered item
- setcounter{tocdepth}{1}% <- only parts, chapters and sections in tocs
- %========================== Begin math in Showindex
- letoldopenparen(
- letoldcloseparen)
- def({protectoldopenparen}
- def){protectoldcloseparen}
- %========================== End math in Showindex
- %========================== Begin Andrew code for ref to indexed words as edited Oct 27 at 17:24
- newcommand{INDEX}[2][]{phantomsection%
- ifrelaxdetokenize{#1}relaxindex{#2}label{ind:#2}%
- elseindex{#2}label{ind:#1}fi%
- }%
- %========================== End Andrew code for ref to indexed words as edited Oct 27 at 17:24
- %===Begin DEX original
- newcommand{DEX}[2][]{%
- ifrelaxdetokenize{#1}relaxhyperref[ind:#2]{#2}%
- % (Cpageref{ind:#2})%
- elsehyperref[ind:#1]{#2}%
- %(Cpageref{ind:#1})%
- fi%
- }%
- %%===End DEX original
- %============== Begin To make Cpageref work with INDEX
- newcommand{PGX}[2][]{%
- ifrelaxdetokenize{#1}%
- relax%
- % hyperref[ind:#2]{#2}%
- Cpageref{ind:#2}%
- else%
- % hyperref[ind:#1]{#2}%
- Cpageref{ind:#1}%
- fi%
- }%
- %============== End To make Cpageref work with INDEX.
- begin{document}
- tableofcontents
- chapter{Chapter Title emboldens %
- 0 and $infty$ but not $0$ nor $x_{0}$ nor $MathText$%
- }%
- label{1-0-0}
- ChapterToc
- Some text
- with an indexed textbf{word}INDEX[]{word} and indexed math $boldsymbol{x_{0}}$INDEX[x0]{$x_{0}$}:
- section{Section Title emboldens %
- 0 and $infty$ as well as $0$ and $x_{0}$ and $MathText$%
- }%
- label{1-1-0}
- A bit more text and finally:
- subsection{%
- Subsection Title emboldens %
- 0 and $infty$ %
- but not $0$ nor $x_{0}$ nor $MathText$. %
- However %
- $boldsymbol{MathText}$, %
- $boldsymbol{x_{0}}$ and %
- $bm{0}$ all work.%
- }%
- label{1-2-1}
- Plus just a tiny little bit of text%
- with a referenced DEX[word]{word} %
- which was indexed in Cref{1-0-0} nameref{1-0-0} on Cpageref{1-0-0}
- phantomsection%otherwise, clicking on index in toc gets to GNU
- addcontentsline{toc}{chapter}{Index}
- printindex
- end{document}
Add Comment
Please, Sign In to add comment