Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
Download

📚 The CoCalc Library - books, templates and other resources

132928 views
License: OTHER
1
2
3
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4
% conditional for xetex or luatex
5
\newif\ifxetexorluatex
6
\ifxetex
7
\xetexorluatextrue
8
\else
9
\ifluatex
10
\xetexorluatextrue
11
\else
12
\xetexorluatexfalse
13
\fi
14
\fi
15
%
16
\ifxetexorluatex%
17
\usepackage{fontspec}
18
\usepackage{libertine} % or use \setmainfont to choose any font on your system
19
\newfontfamily\quotefont[Ligatures=TeX]{Linux Libertine O} % selects Libertine as the quote font
20
\else
21
\usepackage[utf8]{inputenc}
22
\usepackage[T1]{fontenc}
23
\usepackage{libertine} % or any other font package
24
\newcommand*\quotefont{\fontfamily{LinuxLibertineT-LF}} % selects Libertine as the quote font
25
\fi
26
27
\newcommand*\quotesize{60} % if quote size changes, need a way to make shifts relative
28
% Make commands for the quotes
29
\newcommand*{\openquote}
30
{\tikz[remember picture,overlay,xshift=-4ex,yshift=-2.5ex]
31
\node (OQ) {\quotefont\fontsize{\quotesize}{\quotesize}\selectfont``};\kern0pt}
32
33
\newcommand*{\closequote}[1]
34
{\tikz[remember picture,overlay,xshift=4ex,yshift={#1}]
35
\node (CQ) {\quotefont\fontsize{\quotesize}{\quotesize}\selectfont''};}
36
37
% select a colour for the shading
38
\colorlet{shadecolor}{white}
39
40
\newcommand*\shadedauthorformat{\emph} % define format for the author argument
41
42
% Now a command to allow left, right and centre alignment of the author
43
\newcommand*\authoralign[1]{%
44
\if#1l
45
\def\authorfill{}\def\quotefill{\hfill}
46
\else
47
\if#1r
48
\def\authorfill{\hfill}\def\quotefill{}
49
\else
50
\if#1c
51
\gdef\authorfill{\hfill}\def\quotefill{\hfill}
52
\else\typeout{Invalid option}
53
\fi
54
\fi
55
\fi}
56
% wrap everything in its own environment which takes one argument (author) and one optional argument
57
% specifying the alignment [l, r or c]
58
%
59
\newenvironment{shadequote}[2][l]%
60
{\authoralign{#1}
61
\ifblank{#2}
62
{\def\shadequoteauthor{}\def\yshift{-2ex}\def\quotefill{\hfill}}
63
{\def\shadequoteauthor{\par\authorfill\shadedauthorformat{#2}}\def\yshift{2ex}}
64
\begin{snugshade}\begin{quote}\openquote}
65
{\shadequoteauthor\quotefill\closequote{\yshift}\end{quote}\end{snugshade}}
66
67