improved quotation code and templates

This commit is contained in:
Jan Benda 2021-03-06 11:37:29 +01:00
parent 8307eed6a7
commit 4d110dcc0c
2 changed files with 85 additions and 53 deletions

View File

@ -530,59 +530,70 @@
\useasboundingbox (0, 0) rectangle (1ex, 1.7ex);
\node[scale=#1, xshift=-0.45ex, yshift=-0.73ex] at (current bounding box.north east) {\fontfamily{pbk}\selectfont\textquotedblleft};
}}
\newcommand{\closequote}[1][4]{\tikz[baseline]{%
\useasboundingbox (0, 0) rectangle (1ex, 1.7ex);
\node[scale=#1, xshift=-0.45ex, yshift=-0.73ex] at (current bounding box.north east) {\fontfamily{pbk}\selectfont\textquotedblright};
}}
\def\insertquoteauthor{}
\newcommand{\quote@author@left}[1]{%
% #1: template base name
% #2: symbol to the left of the author
% #3: symbol to the right of the author
\newcommand{\quote@author@left}[3]{%
\ifx\insertquoteauthor\@empty\else%
\item[%
\usebeamerfont{#1 author}%
\usebeamercolor{#1 author}%
\usebeamertemplate{#1 author separator}%
\insertquoteauthor]%
#2\insertquoteauthor#3]%
\fi}
\newcommand{\quote@author@right}[1]{%
\newcommand{\quote@author@right}[3]{%
\ifx\insertquoteauthor\@empty\else%
\par{}\hfill%
\usebeamerfont{#1 author}%
\usebeamercolor{#1 author}%
\usebeamertemplate{#1 author separator}%
\insertquoteauthor%
#2\insertquoteauthor#3%
\fi}
\newcommand{\quote@author@rightline}[1]{%
\newcommand{\quote@author@rightline}[3]{%
\ifx\insertquoteauthor\@empty\else%
\hfill%
\usebeamerfont{#1 author}%
\usebeamercolor{#1 author}%
\usebeamertemplate{#1 author separator}%
\insertquoteauthor%
#2\insertquoteauthor#3%
\fi}
% for improvement see
% https://tex.stackexchange.com/questions/13756/quote-environment-with-reference-at-the-end-right
% quotation environment
\defbeamertemplate{quotation symbol}{default}{}
\defbeamertemplate{quotation symbol}{quotes}[1][5]{\usebeamercolor[fg]{quotation symbol}\openquote[#1]}
\setbeamertemplate{quotation symbol}[quotes][4]
\defbeamertemplate{quotation author separator}{default}{}
\defbeamertemplate{quotation author separator}{dash}{ --- }
\setbeamertemplate{quotation author separator}[dash]
\defbeamertemplate{quotation author}{none}{}
\defbeamertemplate{quotation author}{left}{\quote@author@left{quotation}}
\defbeamertemplate{quotation author}{right}{\quote@author@right{quotation}}
\defbeamertemplate{quotation author}{rightline}{\quote@author@rightline{quotation}}
\setbeamertemplate{quotation author}[rightline] % none, left, right, rightline
\defbeamertemplate{quotation begin}{none}{}
\defbeamertemplate{quotation symbol}{openquote}[1][4]{\usebeamercolor[fg]{quotation symbol}\openquote[#1]}
\defbeamertemplate{quotation symbol}{closequote}[1][4]{\usebeamercolor[fg]{quotation symbol}\closequote[#1]}
\setbeamertemplate{quotation symbol}[openquote][4] % default, openquote, closequote
\defbeamertemplate{quotation author}{default}{}
\defbeamertemplate{quotation author}{left}{\quote@author@left{quotation}{}{}}
\defbeamertemplate{quotation author}{leftbrackets}{\quote@author@left{quotation}{(}{)}}
\defbeamertemplate{quotation author}{right}{\quote@author@right{quotation}{}{}}
\defbeamertemplate{quotation author}{rightbrackets}{\quote@author@right{quotation}{(}{)}}
\defbeamertemplate{quotation author}{dashright}{\quote@author@right{quotation}{ --- }{}}
\defbeamertemplate{quotation author}{tilderight}{\quote@author@right{quotation}{ $\sim$ }{}}
\defbeamertemplate{quotation author}{rightline}{\quote@author@rightline{quotation}{}{}}
\defbeamertemplate{quotation author}{rightlinebrackets}{\quote@author@rightline{quotation}{(}{)}}
\defbeamertemplate{quotation author}{dashrightline}{\quote@author@rightline{quotation}{ --- }{}}
\defbeamertemplate{quotation author}{tilderightline}{\quote@author@rightline{quotation}{ $\sim$ }{}}
% default, left, leftbrackets, right, rightbrackets, dashright, tilderight,
% rightline, rightlinebrackets, dashrightline, tilderightline:
\setbeamertemplate{quotation author}[dashrightline]
\defbeamertemplate{quotation begin}{default}{}
\defbeamertemplate{quotation begin}{lines}[1][1pt]{\beamer@horizontal@line@top{quotation line top}{#1}\vskip1ex}
\setbeamertemplate{quotation begin}[lines][0.5pt]
\setbeamertemplate{quotation begin}[lines][0.5pt] % default, lines
\defbeamertemplate{quotation end}{none}{}
\defbeamertemplate{quotation end}{default}{}
\defbeamertemplate{quotation end}{lines}[1][1pt]{\beamer@horizontal@line@bottom{quotation line bottom}{#1}}
\setbeamertemplate{quotation end}[lines][0.5pt]
\setbeamertemplate{quotation end}[lines][0.5pt] % default, lines
\newlength{\beamer@quotation@tmp}
@ -630,29 +641,34 @@
% quote environment:
\defbeamertemplate{quote symbol}{default}{}
\defbeamertemplate{quote symbol}{quotes}[1][5]{\usebeamercolor[fg]{quote symbol}\openquote[#1]}
\setbeamertemplate{quote symbol}[quotes][4]
\defbeamertemplate{quote author separator}{default}{}
\defbeamertemplate{quote author separator}{dash}{ --- }
\setbeamertemplate{quote author separator}[dash]
\defbeamertemplate{quote author}{none}{}
\defbeamertemplate{quote author}{left}{\quote@author@left{quote}}
\defbeamertemplate{quote author}{right}{\quote@author@right{quote}}
\defbeamertemplate{quote author}{rightline}{\quote@author@rightline{quote}}
\setbeamertemplate{quote author}[rightline] % none, left, right, rightline
\defbeamertemplate{quote begin}{none}{}
\defbeamertemplate{quote symbol}{openquote}[1][4]{\usebeamercolor[fg]{quote symbol}\openquote[#1]}
\defbeamertemplate{quote symbol}{closequote}[1][4]{\usebeamercolor[fg]{quote symbol}\closequote[#1]}
\setbeamertemplate{quote symbol}[openquote][4] % default, openquote, closequote
\defbeamertemplate{quote author}{default}{}
\defbeamertemplate{quote author}{left}{\quote@author@left{quote}{}{}}
\defbeamertemplate{quote author}{leftbrackets}{\quote@author@left{quote}{(}{)}}
\defbeamertemplate{quote author}{right}{\quote@author@right{quote}{}{}}
\defbeamertemplate{quote author}{rightbrackets}{\quote@author@right{quote}{(}{)}}
\defbeamertemplate{quote author}{dashright}{\quote@author@right{quote}{ --- }{}}
\defbeamertemplate{quote author}{tilderight}{\quote@author@right{quote}{ $\sim$ }{}}
\defbeamertemplate{quote author}{rightline}{\quote@author@rightline{quote}{}{}}
\defbeamertemplate{quote author}{rightlinebrackets}{\quote@author@rightline{quote}{(}{)}}
\defbeamertemplate{quote author}{dashrightline}{\quote@author@rightline{quote}{ --- }{}}
\defbeamertemplate{quote author}{tilderightline}{\quote@author@rightline{quote}{ $\sim$ }{}}
% default, left, leftbrackets, right, rightbrackets, dashright, tilderight,
% rightline, rightlinebrackets, dashrightline, tilderightline:
\setbeamertemplate{quote author}[dashrightline]
\defbeamertemplate{quote begin}{default}{}
\defbeamertemplate{quote begin}{lines}[1][1pt]{\beamer@horizontal@line@top{quote line top}{#1}\vskip1ex}
\setbeamertemplate{quote begin}[lines][0.5pt]
\setbeamertemplate{quote begin}[lines][0.5pt] % default, lines
\defbeamertemplate{quote end}{none}{}
\defbeamertemplate{quote end}{default}{}
\defbeamertemplate{quote end}{lines}[1][1pt]{\beamer@horizontal@line@bottom{quote line bottom}{#1}}
\setbeamertemplate{quote end}[lines][0.5pt]
\setbeamertemplate{quote end}[lines][0.5pt] % default, lines
\renewenvironment<>{quote}[1][]
{ \def\insertquoteauthor{#1}
@ -691,13 +707,13 @@
% verse environment:
\defbeamertemplate{verse begin}{none}{}
\defbeamertemplate{verse begin}{default}{}
\defbeamertemplate{verse begin}{lines}[1][1pt]{\beamer@horizontal@line@top{verse line top}{#1}\vskip1ex}
\setbeamertemplate{verse begin}[lines][0.5pt]
\setbeamertemplate{verse begin}[lines][0.5pt] % default, lines
\defbeamertemplate{verse end}{none}{}
\defbeamertemplate{verse end}{default}{}
\defbeamertemplate{verse end}{lines}[1][1pt]{\beamer@horizontal@line@bottom{verse line bottom}{#1}}
\setbeamertemplate{verse end}[lines][0.5pt]
\setbeamertemplate{verse end}[lines][0.5pt] % default, lines
\renewenvironment<>{verse}
{ \actionenv#1%

View File

@ -67,6 +67,22 @@
\setbeamertemplate{block theorem begin}[lines]{0.75pt}{0.75pt}
\setbeamertemplate{block theorem end}[lines]{0.75pt}
% default, left, leftbrackets, right, rightbrackets, dashright, tilderight,
% rightline, rightlinebrackets, dashrightline, tilderightline:
\setbeamertemplate{quotation author}[dashrightline]
\setbeamertemplate{quotation symbol}[openquote][4] % default, openquote, closequote
\setbeamertemplate{quotation begin}[lines][0.5pt] % default, lines
% default, left, leftbrackets, right, rightbrackets, dashright, tilderight,
% rightline, rightlinebrackets, dashrightline, tilderightline:
\setbeamertemplate{quote author}[dashrightline]
\setbeamertemplate{quote symbol}[openquote][4] % default, openquote, closequote
\setbeamertemplate{quote begin}[lines][0.5pt] % default, lines
\setbeamertemplate{quote end}[lines][0.5pt] % default, lines
\setbeamertemplate{verse begin}[lines][0.5pt] % default, lines
\setbeamertemplate{verse end}[lines][0.5pt] % default, lines
\setbeamertemplate{title page}[leftlines] % leftlines, centerlines
\setbeamertemplate{title page graphic line}[default][1ex]
\setbeamertemplate{title page title line}[default][0.75pt]