Advertisement
EXLMOTODEV

Pro Git latex template

May 31st, 2014
431
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Latex 4.95 KB | None | 0 0
  1. \documentclass[a4paper]{book}
  2. \usepackage[
  3.     %urlbordercolor = {1 1 1},
  4.     %linkbordercolor = {1 1 1},
  5.     %citebordercolor = {1 1 1},
  6.     urlcolor = blue,
  7.     colorlinks = true,
  8.     citecolor = black,
  9.     linkcolor = black]{hyperref}
  10. \usepackage{graphicx}
  11. \usepackage{xltxtra}
  12. \usepackage{fancyhdr}
  13. \usepackage{booktabs}
  14. \usepackage{indentfirst}
  15. \usepackage{framed,color}
  16. \usepackage{caption}
  17. \usepackage{longtable}
  18. \usepackage{polyglossia}
  19. \setdefaultlanguage{russian}
  20. \setotherlanguage{english}
  21. \setkeys{russian}{babelshorthands=true}
  22. \captionsetup{font=bf,position=below}
  23.  
  24. \usepackage{ctable}
  25.  
  26. \definecolor{shadecolor}{gray}{0.90}
  27.  
  28. \setromanfont[Mapping=tex-text,BoldFont=<%= config['bold'] %>]{<%= config['font'] %>}
  29. \newfontfamily\cyrillicfont[Mapping=tex-text,BoldFont=<%= config['bold'] %>]{<%= config['font'] %>}
  30. \setmonofont[Scale=.80]{<%= config['mono'] %>}
  31. \newfontfamily\cyrillicfonttt[Scale=.80]{<%= config['mono'] %>}
  32.  
  33. \XeTeXlinebreaklocale{<%= lang %>}
  34. <%= config['langrule'] %>
  35.  
  36. \settowidth{\parindent}{<%= config['indent'] %>}
  37.  
  38. \title{Pro Git}
  39. \author{Scott Chacon}
  40.  
  41. \makeatletter
  42. \let\savedauthor=\@author
  43. \let\savedtitle=\@title
  44. \def\imgwidth{.6\linewidth}
  45. \def\maxwidth{\ifdim\Gin@nat@width>\imgwidth\imgwidth
  46. \else\Gin@nat@width\fi}
  47. \makeatother
  48.  
  49. \title{\textbf{\savedtitle}}
  50. \author{\textbf{\savedauthor}\thanks{<%= config['thanks'] %>}}
  51. \def\w3cdtfymd{\the\year-\ifnum\month<10 0\fi\the\month-\ifnum\day<10 0\fi\the\day}
  52. \date{\w3cdtfymd}
  53. \renewcommand{\thefootnote}{\fnsymbol{footnote}}
  54.  
  55. \makeatletter
  56.  \setlength\headheight{12\p@}
  57.  \setlength\headsep   {.25in}
  58.  \setlength\topskip   {10\p@}
  59.  \setlength\footskip{.35in}
  60.  \setlength\textwidth{400\p@}
  61.  
  62.  \setlength\@tempdima{\paperheight}
  63.  \addtolength\@tempdima{-2in}
  64.  \divide\@tempdima\baselineskip
  65.  \@tempcnta=\@tempdima
  66.  \setlength\textheight{\@tempcnta\baselineskip}
  67.  \addtolength\textheight{\topskip}
  68.  
  69.  \setlength\@tempdima        {\paperwidth}
  70.  \addtolength\@tempdima      {-\textwidth}
  71.  \setlength\oddsidemargin    {\paperwidth}
  72.  \addtolength\oddsidemargin  {-2.35in}
  73.  \addtolength\oddsidemargin  {-\textwidth}
  74.  \setlength\marginparwidth   {0pt}
  75.  \@settopoint\oddsidemargin
  76.  \@settopoint\marginparwidth
  77.  \setlength\evensidemargin  {\paperwidth}
  78.  \addtolength\evensidemargin{-2.35in}
  79.  \addtolength\evensidemargin{-\textwidth}
  80.  \@settopoint\evensidemargin
  81.  
  82.  \setlength\topmargin{\paperheight}
  83.  \addtolength\topmargin{-2in}
  84.  \addtolength\topmargin{-\headheight}
  85.  \addtolength\topmargin{-\headsep}
  86.  \addtolength\topmargin{-\textheight}
  87.  \addtolength\topmargin{-\footskip}     % this might be wrong!
  88.   \addtolength\topmargin{-.5\topmargin}
  89.  \@settopoint\topmargin
  90. \makeatother
  91.  
  92. \fancypagestyle{plain}{\fancyhf{}\fancyfoot[LE,RO]{\footnotesize\textbf\thepage}}
  93. \pagestyle{plain}
  94.  
  95. \renewcommand{\headrulewidth}{0pt}
  96. \renewcommand{\footrulewidth}{0pt}
  97.  
  98. \newcounter{img}[chapter]
  99. \renewcommand{\theimg}{\thechapter.\arabic{img}}
  100. \newcommand{\img}[1]{\begin{figure}[ht!]
  101.     \refstepcounter{img}
  102.     \label{img:\theimg}
  103.     \centering\IfFileExists{figures/\theimg.pdf}{\includegraphics[width=\maxwidth]{figures/\theimg.pdf}}{\includegraphics[width=\maxwidth]{figures/\theimg.png}}
  104.  
  105.     \caption{#1}
  106. \end{figure}}
  107.  
  108. \newcounter{tab}[chapter]
  109. \renewcommand{\thetab}{\thechapter.\arabic{tab}}
  110.  
  111. \newcommand{\prechap}{<%= config['prechap'] %>}
  112. \newcommand{\postchap}{<%= config['postchap'] %>}
  113. \newcommand{\presect}{<%= config['presect'] %>}
  114. \newcommand{\postsect}{<%= config['postsect'] %>}
  115. \renewcommand{\chaptermark}[1]{\markboth{\textbf{\prechap \thechapter \postchap}\hspace*{1ex}#1}{}}
  116. \renewcommand{\sectionmark}[1]{\markright{\textbf{\presect \thesection \postsect}\hspace*{1ex}#1}}
  117. \newcommand{\chap}[1]{\newpage\thispagestyle{empty}\chapter{#1}\label{chap:\thechapter}}
  118. \newcommand{\chapref}[1]{\hyperref[chap:#1]{\prechap #1\postchap}}
  119. \newcommand{\imgref}[1]{\hyperref[img:#1]{<%= config['fig'] %>#1}}
  120. \newcommand{\tabref}[1]{\hyperref[tab:#1]{<%= config['tab'] %>#1}}
  121. \newcommand{\e}[1]{$ \times 10^{#1}$}
  122. \renewcommand{\contentsname}{<%= config['con'] %>}
  123. \renewcommand{\figurename}{<%= config['fig'] %>}
  124. \renewcommand{\tablename}{<%= config['tab'] %>}
  125.  
  126. \makeatletter
  127. \def\@makechapterhead#1{%
  128.   \vspace*{50\p@}%
  129.   {\parindent \z@ \raggedright \normalfont
  130.    \ifnum \c@secnumdepth >\m@ne
  131.      \if@mainmatter
  132.        \huge\bfseries \prechap \thechapter \postchap
  133.        \par\nobreak
  134.        \vskip 20\p@
  135.      \fi
  136.    \fi
  137.    \interlinepenalty\@M
  138.    \Huge \bfseries #1\par\nobreak
  139.    \vskip 40\p@
  140.  }}
  141. \makeatother
  142.  
  143. \linespread{1.3}
  144.  
  145. \begin{document}
  146. \frontmatter
  147. \maketitle
  148. \thispagestyle{empty}
  149. \setcounter{tocdepth}{4}
  150. \tableofcontents\newpage\thispagestyle{empty}
  151.  
  152. \mainmatter
  153. \fancyhf{}
  154. \fancyhead[LE]{{\small\leftmark}}
  155. \fancyhead[RO]{{\small\rightmark}}
  156. \fancyhead[RE,LO]{{\small\savedauthor\hspace*{1ex}\textbf{\savedtitle}}}
  157. \fancyfoot[LE,RO]{\small\textbf\thepage}
  158. \pagestyle{fancy}
  159.  
  160. <%= latex %>
  161. \end{document}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement