-
Notifications
You must be signed in to change notification settings - Fork 65
/
style.sty
271 lines (239 loc) · 8.94 KB
/
style.sty
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
% Free range VHDL
% Authors: Bryan Mealy, Fabrizio Tappero
% Date: January, 2023
% URL: https://github.com/fabriziotappero/Free-Range-VHDL-book
% (C) 2018-2023 B. Mealy, F. Tappero
%
% !TEX root = master.tex
%
% NOTE: do not forget to install texlive-latex-extra (with, for instance Ubuntu Synaptic)
\usepackage[australian]{babel}
\usepackage{graphicx}
\usepackage{framed}
%\usepackage[width=13cm, left=2cm, top=2.5cm , bottom= 2cm ]{geometry} % A5 paper version
\usepackage[vcentering,dvips, width=12.3cm, left=2.0cm, top=2.2cm , bottom= 2.2cm]{geometry}
%\geometry{papersize={160mm,240mm},total={127mm,200mm}} % for 160x240 fomat
\geometry{papersize={160mm,240mm}} % for 160x240 fomat
% add DRAFT writing for each page
%\usepackage{draftwatermark}
%\SetWatermarkScale{5}
%\SetWatermarkLightness{0.93}
\usepackage[titletoc]{appendix}
\usepackage{boxedminipage}
\usepackage[utf8]{inputenc}
\usepackage[dvipsnames]{xcolor}
\usepackage[absolute]{textpos}
\textblockorigin{0mm}{0mm}
\setlength{\parindent}{0pt}
\usepackage{listings}
\usepackage{changepage}
\usepackage{tabularx,colortbl}
\usepackage{multirow}
% some Basic page setups
%\addtolength{\parskip}{0.01\baselineskip} % change new paragraph line spacing
\setlength{\parindent}{8pt} % paragraph indentation
\frenchspacing % no new paragraph line space
\raggedbottom % force white space at the end of a page
\usepackage[bottom]{footmisc}% position footnotes at the end of the page
% for drawing diagrams
\usepackage{tikz}
\usetikzlibrary{shapes.gates.logic.US,trees,positioning,arrows,calc,automata,tikzmark,backgrounds}
%\tikzset{background rectangle/.style={fill=red!8, rounded corners}, tight background}
\tikzset{background rectangle/.style={fill=white, rounded corners}, tight background}
\tikzset{every node/.style={font=\sffamily\footnotesize}} % font size in all drawings
% for formulae using NOT
\newcommand{\NOT}[1]{$\overline{#1}$}
\newcommand{\NOTT}[1]{$\overline{\mbox{#1}}$}
% including PDFs
\usepackage{pdfpages}
\graphicspath{{./pics/}}
\title{free range vhdl}
\author{Bryan Mealy, Fabrizio Tappero}
\date{\today}
% eliminate dots in table of contents
\renewcommand{\@dotsep}{10000}
% changes distance between section number and section title in table of contents
\makeatletter
\renewcommand{\l@section}{\@dottedtocline{1}{1.5em}{2.6em}}
\renewcommand{\l@subsection}{\@dottedtocline{2}{4.0em}{3.6em}}
\renewcommand{\l@subsubsection}{\@dottedtocline{3}{7.4em}{4.5em}}
\makeatother
% eliminate indentation in quote environment
\renewenvironment{quotation}{\list{}{\leftmargin=0.3in\rightmargin=0.8in}\item[]}{\endlist}
% re-style the itemize adding the command \compactlist
\usepackage{pifont}
% my_list environment
\newenvironment{my_list}{
\begin{list}{ % % Begin list item label code
\textbullet
}{ % %%%% Begin list item body code
\setlength{\labelwidth}{14pt}
\setlength{\leftmargin}{1.5em}
\setlength{\labelsep}{0.5em}
\setlength{\itemsep}{4pt}
\setlength{\parsep}{3pt}
\setlength{\topsep}{3pt}
\setlength{\partopsep}{0pt}%
\setlength\itemindent{0pt}
} % End list item body code
}{ % Begin wrapup environment code
\end{list}
} % End wrapup environment code
% my_num_list environment
\newenvironment{my_num_list}{
\begin{enumerate}{ % % Begin list item label code
%\ding{43}
}{ % %%%% Begin list item body code
\setlength{\labelwidth}{14pt}
\setlength{\leftmargin}{1.5em}
\setlength{\labelsep}{0.5em}
\setlength{\itemsep}{4pt}
\setlength{\parsep}{3pt}
\setlength{\topsep}{3pt}
\setlength{\partopsep}{0pt}%
\setlength\itemindent{0pt}
} % End list item body code
}{ % Begin wrapup environment code
\end{enumerate}
} % End wrapup environment code
% VHDL code box
\usepackage{listings}
\definecolor{light-gray}{gray}{0.96}
\definecolor{pageheading-gray}{gray}{0.2}
\definecolor{dark-gray}{gray}{0.45}
\definecolor{dark-green}{rgb}{0.245,0.121,0.0}
\usepackage{upquote} % this fix listings accents and aphostrophies
\usepackage{courier}
\lstdefinelanguage{VHDL}{
morekeywords=[1]{
ACCESS,ATTRIBUTE,BEGIN,BODY,BUS,BLOCK,BUFFER,CONSTANT,CASE,%
COMPONENT,CONFIGURATION,DOWNTO,ELSE,ELSIF,END,ENTITY,EXIT,%
FUNCTION,FOR,FILE,GENERIC,GENERATE,GUARDED,GROUP,IF,IN,INOUT,IS,%
INERTIAL,IMPURE,LIBRARY,LOOP,LABEL,LITERAL,LINKAGE,MAP,MOD,NOT,%
NOR,NAND,NULL,NEXT,NEW,OUT,OF,OR,OTHERS,ON,OPEN,PROCESS,PORT,%
PACKAGE,PURE,PROCEDURE,POSTPONED,RANGE,REM,ROL,ROR,REPORT,RECORD,%
RETURN,REGISTER,REJECT,SIGNAL,SUBTYPE,SLL,SRL,SLA,SRA,SEVERITY,%
SELECT,THEN,TYPE,TRANSPORT,TO,USE,UNITS,UNTIL,VARIABLE,WHEN,WAIT,%
WHILE,XOR,XNOR,%
DISCONNECT,ELIF,WITH},% Arnaud Tisserand
sensitive=f,% 1998 Gaurav Aggarwal
morestring=[d]{"},%
morekeywords=[2]{
std_logic_vector,std_logic,std_logic_1164,numeric_std,numeric_signed,numeric_unsigned,numeric_bit,math_real,math_complex,
unsigned,integer,
rising_edge,to_integer,resize
},
morecomment=[l]--
}
\colorlet{STD}{Lavender}
\lstset{
language=VHDL,
basicstyle=\scriptsize\ttfamily, % font size for code
%basicstyle=\tiny\ttfamily,
lineskip= -1pt, % space between code lines (default: 0pt)
%numbers=left,
numberstyle=\tiny,
%stepnumber=2,
numbersep=5pt,
aboveskip={0pt},
tabsize=4,
extendedchars=true,
breaklines=true,
classoffset=0,
morecomment=[s][\textit]{my_lab}{el}, % make the label word italics
otherkeywords={<=,:=, shared,=>,'}, % add <=, shared
keywordstyle=\color{blue},
keywordstyle = [2]\color{STD}\bfseries,
commentstyle=\color[RGB]{10,140,20}, % green color
frame=b, % turn on end line
rulecolor=\color{dark-gray}, % end line color
%captionpos=b,
belowcaptionskip=2pt,
stringstyle=\color{red}\ttfamily,
morestring=[b]',
showspaces=false,
showtabs=false,
xleftmargin=3pt,
framexleftmargin=3pt,
framexrightmargin=0pt,
framexbottommargin=1pt,
backgroundcolor=\color{light-gray},
showstringspaces=false}
\usepackage[hang, bf, small]{caption}
\DeclareCaptionFont{white}{\color{white}}
\DeclareCaptionFormat{listing}{\colorbox{dark-gray}{\parbox[c][9pt][c]{\textwidth-6pt}{\hspace{3pt}#1#2#3}}} % I added -6pt (NOT SURE WHY !!)
\captionsetup[lstlisting]{format=listing,labelfont=white,textfont=white, singlelinecheck=false, margin=0pt, font={bf,scriptsize}}
% restyle page header
% ftp://ctan.tug.org/tex-archive/macros/latex/contrib/fancyhdr/fancyhdr.pdf
\usepackage{fancyhdr}
\pagestyle{fancy}
\usepackage{calc}
\fancyheadoffset[LE,RO]{\marginparsep+\marginparwidth-18.0mm} % OFFSET HEADER. offset page number
\renewcommand{\chaptermark}[1]{\markboth{\color{pageheading-gray}{\small\chaptername\ %change page heading size here
\thechapter:\ #1}}{}}
\renewcommand{\sectionmark}[1]{\markright{\color{pageheading-gray}{\small\thesection\ #1}}} %change page heading size here
\fancyhf{}
\fancyhead[LE,RO]{\color{pageheading-gray}{\sffamily\small\thepage}} % change page number font size here
\fancyhead[LO]{\nouppercase{\sffamily\rightmark}}
\fancyhead[RE]{\nouppercase{\sffamily\leftmark}}
\fancypagestyle{plain}{%
\fancyhead{} % get rid of headers in the chapter page
\renewcommand{\headrulewidth}{0pt} % no line in the chapter page
}
\renewcommand{\headrulewidth}{0pt} % thin page header line
\renewcommand{\headrule}{{\color{gray}% set line colour
\hrule width\headwidth height\headrulewidth \vskip-\headrulewidth}}
% restyle section headings
\usepackage{titlesec}
%\titlespacing*{\chapter} {0pt}{50pt}{40pt}
\titlespacing*{\section} {0pt}{*2.4}{*1.1}
\titlespacing*{\subsection} {0pt}{*2.2}{*1.1}
\titlespacing*{\subsubsection} {0pt}{*2.4}{*1.1}
%section
\titleformat{\section}[block]
{\sffamily\large\bfseries}{\sffamily\large\bfseries\thesection}{0.4em}{}
% subsection
\titleformat{\subsection}[block]
{\sffamily\bfseries}{\normalfont\sffamily\bfseries\thesubsection}{0.4em}{}
% subusubsection
\titleformat{\subsubsection}[block]
{\sffamily\small\bfseries}{\thesubsubsection}{0.4em}{}
% minor customisation
\renewcommand{\figurename}{Fig.}
\renewcommand{\tablename}{Tab.}
% restyle chapter heading
\usepackage[Bjornstrup]{fncychap}
% fix some Fancyhdr warnings
\setlength{\headheight}{15pt}
% make an empty page before a chapter begin
\makeatletter
\def\cleardoublepage{\clearpage\if@twoside \ifodd\c@page\else
\hbox{}
%\vspace*{\fill}
%\begin{center}
%This page intentionally contains only this sentence.
%\end{center}
%\vspace{\fill}
\thispagestyle{empty}
\newpage
\if@twocolumn\hbox{}\newpage\fi\fi\fi}
\makeatother
\usepackage{pageslts} % count pages in document and more
\usepackage{microtype} % make LaTeX typesetting beautiful
% to debug overfull
% \overfullrule=1mm
\usepackage{hyperref}
% PDF tags
\hypersetup{
pdfauthor = {Bryan Mealy, Fabrizio Tappero},
pdftitle = {FREE RANGE VHDL},
pdfsubject = {vhdl book},
pdfkeywords = {computer, language, vhdl, verilog, fpga, cpld, },
pdfcreator = {Latex and Linux},
pdfproducer = {Latex},
pdfnewwindow=true, % links in new window
colorlinks=true, % false: boxed links; true: colored links
linkcolor=black, % internal links
citecolor=green, % links to bibliography
filecolor=magenta, % file links
urlcolor=darkgray} % external links