Commit 61302ef2 authored by Benoit Rat's avatar Benoit Rat

doc: fixing bugs (longtable), and improve colors, templates, etc..

doc: pandoc: by default figure "fit here if possible" (H)
doc: new line after paragraph (4th level of markdown title)
doc: change link color so that link color is more highlighted
doc: improve color scheme with hostname
doc: add alternate color for longtable in pandoc.latex
doc: fix a bug with longtable when using pandoc 1.12.2.1
parent 34fe006e
...@@ -13,9 +13,13 @@ ...@@ -13,9 +13,13 @@
%% ensure the GNU Lesser General Public License version 2.1 requirements %% ensure the GNU Lesser General Public License version 2.1 requirements
%% will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. %% will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\documentclass[a4paper,oneside,$if(fontsize)$$fontsize$,$endif$$if(lang)$$lang$,$endif$]{$documentclass$}
\documentclass[a4paper,oneside,table,$if(fontsize)$$fontsize$,$endif$$if(lang)$$lang$,$endif$]{$documentclass$}
\usepackage{amssymb,amsmath} \usepackage{amssymb,amsmath}
\usepackage[left=2.2cm,right=2.2cm,top=3cm,bottom=3cm]{geometry} \usepackage[left=2.2cm,right=2.2cm,top=2cm,bottom=2cm]{geometry}
\providecommand{\tightlist}{%
\setlength{\itemsep}{0pt}\setlength{\parskip}{0pt}}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%% Xetex. %%% Xetex.
...@@ -40,13 +44,13 @@ ...@@ -40,13 +44,13 @@
unicode=false, % unicode breaks when used with xetex unicode=false, % unicode breaks when used with xetex
xetex, xetex,
colorlinks=true, colorlinks=true,
urlcolor=blue, urlcolor=darksevenblue,
anchorcolor=blue, anchorcolor=darksevenblue,
linkcolor=blue]{hyperref} linkcolor=darksevenblue]{hyperref}
\else \else
\usepackage[unicode=true, \usepackage[unicode=true,
colorlinks=true, colorlinks=true,
linkcolor=blue]{hyperref} linkcolor=darksevenblue]{hyperref}
\fi \fi
...@@ -62,7 +66,12 @@ $endif$ ...@@ -62,7 +66,12 @@ $endif$
\hypersetup{breaklinks=true, pdfborder={0 0 0}} \hypersetup{breaklinks=true, pdfborder={0 0 0}}
\usepackage{pbox} \usepackage{pbox}
\usepackage{wallpaper}
%% Define common color
\usepackage{color}
\definecolor{darksevenblue}{RGB}{10,100,130}
\definecolor{sevensolsblue}{RGB}{15,130,175}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% Environment for code formatting %% Environment for code formatting
...@@ -70,6 +79,7 @@ $endif$ ...@@ -70,6 +79,7 @@ $endif$
%% Define the background (shade) color %% Define the background (shade) color
\usepackage{color} \usepackage{color}
\definecolor{darkblue}{RGB}{8,40,80}
\definecolor{shadecolor}{RGB}{$bg-color$} \definecolor{shadecolor}{RGB}{$bg-color$}
\definecolor{darkgreen}{RGB}{0,125,0} \definecolor{darkgreen}{RGB}{0,125,0}
\definecolor{darkred}{RGB}{170,0,0} \definecolor{darkred}{RGB}{170,0,0}
...@@ -96,7 +106,7 @@ $if(listings)$ ...@@ -96,7 +106,7 @@ $if(listings)$
keywords={sudo}, keywords={sudo},
alsoletter={\#,:,>},% alsoletter={\#,:,>},%
emph={>:\# ,>:$$}, emph={>:\# ,>:$$},
moreemph={wrc\# ,wrc1\# ,wrc2\# , >spusa:\# ,>tornado:\# }, moreemph={wrc\# ,wrc1\# ,wrc2\# ,root@wrztp,\/\#},
emphstyle=\color{darkred}, emphstyle=\color{darkred},
comment=[l]{\#\#},% comment=[l]{\#\#},%
morestring=[s]{\{}{\}}, morestring=[s]{\{}{\}},
...@@ -181,27 +191,49 @@ $endif$ ...@@ -181,27 +191,49 @@ $endif$
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\usepackage{float} % provides the H option for float placement \usepackage{float} % provides the H option for float placement
\floatplacement{figure}{H}
%% Tables %% Tables
$if(tables)$ $if(tables)$
\usepackage{ctable} \usepackage{ctable}
\usepackage{longtable}
% alternate rowcolors for all long-tables
\let\oldlongtable\longtable
\let\endoldlongtable\endlongtable
\renewenvironment{longtable}{\rowcolors{2}{white}{shadecolor}\small\oldlongtable}{\endoldlongtable\normalsize}
% Change style for first row
\let\oldtoprule\toprule
\renewcommand{\toprule}{\oldtoprule\rowcolor{white}}
$endif$ $endif$
%% Images %% Images
\usepackage{graphicx} \usepackage{caption,subcaption}
% We will generate all images so they have a width \maxwidth. This means % Redefine \includegraphics so that, unless explicit options are
% that they will get their normal width if they fit onto the page, but % given, the image width will not exceed the width or the height of the page.
% Images get their normal width if they fit onto the page, but
% are scaled down if they would overflow the margins. % are scaled down if they would overflow the margins.
\makeatletter \makeatletter
\def\maxwidth{\ifdim\Gin@nat@width>\linewidth\linewidth \def\ScaleWidthIfNeeded{%
\else\Gin@nat@width\fi} \ifdim\Gin@nat@width>\linewidth
\makeatother 0.8\linewidth
\makeatletter \else
\def\maxheight{\ifdim\Gin@nat@height>10cm10cm \Gin@nat@width
\else\Gin@nat@height\fi} \fi
}
\def\ScaleHeightIfNeeded{%
\ifdim\Gin@nat@height>0.9\textheight
0.7\textheight
\else
\Gin@nat@width
\fi
}
\makeatother \makeatother
\let\Oldincludegraphics\includegraphics
\renewcommand{\includegraphics}[1]{\Oldincludegraphics[width=\maxwidth, height=\maxheight, keepaspectratio]{#1}} \setkeys{Gin}{width=\ScaleWidthIfNeeded,height=\ScaleHeightIfNeeded,keepaspectratio}
$if(subscript)$ $if(subscript)$
\newcommand{\textsubscr}[1]{\ensuremath{_{\scriptsize\textrm{#1}}}} \newcommand{\textsubscr}[1]{\ensuremath{_{\scriptsize\textrm{#1}}}}
...@@ -245,7 +277,7 @@ $if(fancy-enums)$ ...@@ -245,7 +277,7 @@ $if(fancy-enums)$
\listparindent=0pt \listparindent=0pt
\topsep=2pt plus 2pt minus 2pt \topsep=2pt plus 2pt minus 2pt
\partopsep=0pt plus 1pt minus 10pt \partopsep=0pt plus 1pt minus 10pt
\parsep=2pt plus 1pt \parsep=1pt plus 1pt
\itemsep=\parsep \itemsep=\parsep
} }
}\makeatother }\makeatother
...@@ -262,6 +294,17 @@ $endif$ ...@@ -262,6 +294,17 @@ $endif$
%%% Chapters & Section %%% Chapters & Section
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%Use by with \autoref
\AtBeginDocument{%
\renewcommand{\chapterautorefname}{Chapter\negthinspace}
\renewcommand{\sectionautorefname}{\S\negthinspace}
\renewcommand{\subsectionautorefname}{\S\negthinspace}
\renewcommand{\subsubsectionautorefname}{\S\negthinspace}
\renewcommand{\figureautorefname}{Fig.\negthinspace}
\renewcommand{\subfigureautorefname}{Fig.\negthinspace}
\renewcommand{\tableautorefname}{Tab.\negthinspace}
}
% chapters % chapters
\usepackage{titlesec} \usepackage{titlesec}
\titleformat{\chapter}[block] \titleformat{\chapter}[block]
...@@ -271,16 +314,18 @@ $endif$ ...@@ -271,16 +314,18 @@ $endif$
% Sections % Sections
$if(numbersections)$ $if(numbersections)$
\setcounter{secnumdepth}{2}
$else$ $else$
\newpage
\setcounter{secnumdepth}{0} \setcounter{secnumdepth}{0}
$endif$ $endif$
\usepackage{titlesec}
\newcommand{\sectionbreak}{\clearpage}
\let\oldthesection=\thesection
\let\oldsection\section %% Paragraph (adding new line)
\renewcommand{\section}{\clearpage\oldsection} \titleformat{\paragraph}[hang]{\normalfont\normalsize\bfseries}{\theparagraph}{1em}{}
\titlespacing*{\paragraph}{0pt}{3.25ex plus 1ex minus .2ex}{0.5em}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%% Footer & Header %%% Footer & Header
...@@ -290,16 +335,36 @@ $if(verbatim-in-note)$ ...@@ -290,16 +335,36 @@ $if(verbatim-in-note)$
% allows verbatim text in footnotes % allows verbatim text in footnotes
$endif$ $endif$
$if(weburl)$
\newcommand{\weburl}{\url{$weburl$}}
$else$
\newcommand{\weburl}{\url{www.sevensols.com}}
$endif$
\usepackage{fancyhdr} \usepackage{fancyhdr}
\fancyhf{} \fancyhf{}
\fancyhead[R]{\nouppercase{\leftmark}}
\fancyfoot[L]{ www.sevensols.com/whiterabbitsolution}% empty left
\fancyfoot[L]{\raisebox{-25pt}{\includegraphics{logo.png}}}
\fancyfoot[C]{\raisebox{-15pt}{\small \url{www.sevensols.com/whiterabbitsolution}}}
\fancyfoot[R]{\raisebox{-15pt}{\thepage}}
\pagestyle{fancy} % Sets fancy header and footer
%% Header
\fancyhead[L]{\raisebox{0pt}{\includegraphics[height=7mm]{logo.png}}}
\fancyhead[R]{\small \nouppercase{\leftmark}}
\renewcommand{\headrulewidth}{1pt}
%% Footer
\renewcommand{\footrulewidth}{1pt}
\fancyfoot[L]{{\scriptsize \bfseries $title$ - $title-prefix$} \\ \raisebox{5pt}{\tiny $date$}}
\fancyfoot[C]{\raisebox{0pt}{\small \weburl }}
\fancyfoot[R]{\raisebox{0pt}{\scriptsize \thepage}}
\usepackage{etoolbox}
\makeatletter
%\patchcmd{\@fancyhead}{\rlap}{\color{sevensolsblue}\rlap}{}{} %%text
%\patchcmd{\@fancyfoot}{\rlap}{\color{sevensolsblue}\rlap}{}{} %%text
\patchcmd{\headrule}{\hrule}{\color{sevensolsblue}\hrule}{}{} %%line
\patchcmd{\footrule}{\hrule}{\color{sevensolsblue}\hrule}{}{} %%line
\makeatother
\pagestyle{fancy} % Sets fancy header and footer
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% Bibliography %% Bibliography
...@@ -321,39 +386,50 @@ $endif$ ...@@ -321,39 +386,50 @@ $endif$
%%% Title page (like texinfo) %%% Title page (like texinfo)
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\DeclareFixedFont{\bigsf}{T1}{phv}{b}{n}{1.5cm}
$if(title)$ $if(title)$
\title{$title$} \title{$if(title-prefix)$\huge{$title-prefix$}\\\vspace{5mm}$endif${\bigsf $title$}}
$endif$ $endif$
$if(author)$ $if(author)$
\author{$for(author)$$author$$sep$ \and $endfor$} \author{$for(author)$$author$$sep$, $endfor$}
$endif$ $endif$
$if(date)$ $if(date)$
$if(version)$
\date{v$version$: $date$}
$else$
\date{$date$} \date{$date$}
$endif$ $endif$
$endif$
\makeatletter \makeatletter
\def\thickhrulefill{\leavevmode \leaders \hrule height 1pt\hfill \kern \z@} \def\thickhrulefill{\leavevmode \leaders \hrule height 1pt\hfill \kern \z@}
\renewcommand{\maketitle}{\begin{titlepage}% \renewcommand{\maketitle}{\begin{titlepage}%
\let\footnotesize\small $if(imgcover)$
\let\footnoterule\relax \ThisLRCornerWallPaper{1}{$imgcover$}
\parindent \z@ $endif$
\reset@font \vspace{5mm}
\null\vfil \begin{minipage}{\textwidth}
\begin{flushleft} \vspace{4.5cm}
\Huge \textbf{\@title}
\end{flushleft}
\par
\hrule height 4pt
\par
\begin{flushright} \begin{flushright}
\large \@date \par \fontsize{10pt}{8pt}\selectfont
{\@date}
\end{flushright} \end{flushright}
\vskip 500\p@ \end{minipage}
\vfil\null \begin{minipage}{\textwidth}
\vspace{5.8cm}
\noindent
\begin{center}
\textsc{\textbf{\@title}}
\end{center}
\vspace{7cm}
\begin{flushleft} \begin{flushleft}
\Large \textbf{\@author} {\Large \textbf{\@author}}\\
\vspace{2cm}
{\large \OldTexttt{Seven Solutions S.L}}\\
{\url{www.sevensols.com}}
\end{flushleft} \end{flushleft}
\hrule height 2pt \end{minipage}
\end{titlepage}% \end{titlepage}%
\setcounter{footnote}{0}% \setcounter{footnote}{0}%
} }
...@@ -364,6 +440,8 @@ $endif$ ...@@ -364,6 +440,8 @@ $endif$
\begin{document} \begin{document}
\renewcommand{\familydefault}{\sfdefault}
$if(title)$ $if(title)$
\maketitle \maketitle
$endif$ $endif$
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment