exanded quotation code and examples

This commit is contained in:
Jan Benda 2021-03-07 09:00:36 +01:00
parent 9ffbb28a3e
commit 8681affc34
5 changed files with 227 additions and 102 deletions

View File

@ -81,16 +81,18 @@
\setbeamercolor{message item}{fg=red}
\setbeamercolor{message item symbol}{fg=red}
\setbeamercolor{verse}{fg=, bg=black!15}
\setbeamercolor{verse line top}{fg=green}
\setbeamercolor{verse line bottom}{fg=green}
\setbeamercolor{verse}{parent=normal text, bg=black!15}
\setbeamercolor{verse line top}{fg=}
\setbeamercolor{verse line bottom}{fg=}
\setbeamercolor{quote}{fg=, bg=black!15}
\setbeamercolor{quote}{parent=normal text, bg=black!15}
\setbeamercolor{quote symbol}{fg=red}
\setbeamercolor{quote source}{parent=quote}
\setbeamercolor{quote line top}{fg=red}
\setbeamercolor{quote line bottom}{fg=red}
\setbeamercolor{quotation}{fg=, bg=black!15}
\setbeamercolor{quotation}{parent=normal text, bg=black!15}
\setbeamercolor{quotation source}{parent=quote}
\setbeamercolor{quotation symbol}{fg=blue}
\setbeamercolor{quotation line top}{fg=blue}
\setbeamercolor{quotation line bottom}{fg=blue}

View File

@ -83,16 +83,18 @@
\setbeamercolor{message item symbol}{fg=utgold}
\setbeamercolor{verse}{fg=, bg=utgreen!20}
\setbeamercolor{verse line top}{fg=utgreen}
\setbeamercolor{verse line bottom}{fg=utgreen}
\setbeamercolor{verse line top}{fg=}
\setbeamercolor{verse line bottom}{fg=}
\setbeamercolor{quote}{fg=, bg=utgreen!20}
\setbeamercolor{quote symbol}{fg=utred}
\setbeamercolor{quote source}{parent=quote}
\setbeamercolor{quote line top}{fg=}
\setbeamercolor{quote line bottom}{fg=}
\setbeamercolor{quotation}{fg=, bg=utgreen!20}
\setbeamercolor{quotation symbol}{fg=utblue}
\setbeamercolor{quotation source}{parent=quote}
\setbeamercolor{quotation line top}{fg=}
\setbeamercolor{quotation line bottom}{fg=}

View File

@ -502,44 +502,75 @@
}
%%%%% verse, quotation, quote:
% verse environment:
\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] % default, lines
\defbeamertemplate{verse end}{default}{}
\defbeamertemplate{verse end}{lines}[1][1pt]{\beamer@horizontal@line@bottom{verse line bottom}{#1}}
\setbeamertemplate{verse end}[lines][0.5pt] % default, lines
\renewenvironment<>{verse}
{ \actionenv#1%
\setlength{\beamer@quotation@tmp}{\linewidth}
\beamercolorbox[vmode,wd=\linewidth]{verse}
\usebeamertemplate{verse begin}
\usebeamerfont*{verse}%
\list{}{
\leftmargin 2em
\rightmargin 2em
\parsep 1ex
}%
\item\relax
}
{%
\endlist
\setlength{\linewidth}{\beamer@quotation@tmp}
\usebeamertemplate{verse end}
\endbeamercolorbox
\endactionenv%
}
%%%%% quotation, quote:
% font selection
% https://tex.stackexchange.com/questions/25249/how-do-i-use-a-particular-font-for-a-small-section-of-text-in-my-document
% pbk , phv, pnc, qcs
\newcommand{\openquote}[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\textquotedblleft};
\node[scale=#1, xshift=-0.45ex, yshift=-0.75ex] 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};
\node[scale=#1, xshift=-0.45ex, yshift=-0.75ex] at (current bounding box.north east) {\fontfamily{pbk}\selectfont\textquotedblright};
}}
\def\insertquoteauthor{}
\def\insertquotesource{}
% #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%
% #2: symbol to the left of the source
% #3: symbol to the right of the source
\newcommand{\quote@source@left}[3]{%
\ifx\insertquotesource\@empty\else%
\item[%
\usebeamerfont{#1 author}%
\usebeamercolor{#1 author}%
#2\insertquoteauthor#3]%
\usebeamerfont{#1 source}%
\usebeamercolor{#1 source}%
#2\insertquotesource#3]%
\fi}
\newcommand{\quote@author@right}[3]{%
\ifx\insertquoteauthor\@empty\else%
\newcommand{\quote@source@right}[3]{%
\ifx\insertquotesource\@empty\else%
\par{}\hfill%
\usebeamerfont{#1 author}%
\usebeamercolor{#1 author}%
#2\insertquoteauthor#3%
\usebeamerfont{#1 source}%
\usebeamercolor{#1 source}%
#2\insertquotesource#3%
\fi}
\newcommand{\quote@author@rightline}[3]{%
\ifx\insertquoteauthor\@empty\else%
\newcommand{\quote@source@rightline}[3]{%
\ifx\insertquotesource\@empty\else%
\hfill%
\usebeamerfont{#1 author}%
\usebeamercolor{#1 author}%
#2\insertquoteauthor#3%
\usebeamerfont{#1 source}%
\usebeamercolor{#1 source}%
#2\insertquotesource#3%
\fi}
% for improvement see
% https://tex.stackexchange.com/questions/13756/quote-environment-with-reference-at-the-end-right
@ -552,21 +583,21 @@
\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$ }{}}
\defbeamertemplate{quotation source}{default}{}
\defbeamertemplate{quotation source}{left}{\quote@source@left{quotation}{}{}}
\defbeamertemplate{quotation source}{leftbrackets}{\quote@source@left{quotation}{(}{)}}
\defbeamertemplate{quotation source}{right}{\quote@source@right{quotation}{}{}}
\defbeamertemplate{quotation source}{rightbrackets}{\quote@source@right{quotation}{(}{)}}
\defbeamertemplate{quotation source}{dashright}{\quote@source@right{quotation}{ --- }{}}
\defbeamertemplate{quotation source}{tilderight}{\quote@source@right{quotation}{ $\sim$ }{}}
\defbeamertemplate{quotation source}{rightline}{\quote@source@rightline{quotation}{}{}}
\defbeamertemplate{quotation source}{rightlinebrackets}{\quote@source@rightline{quotation}{(}{)}}
\defbeamertemplate{quotation source}{dashrightline}{\quote@source@rightline{quotation}{ --- }{}}
\defbeamertemplate{quotation source}{tilderightline}{\quote@source@rightline{quotation}{ $\sim$ }{}}
% default, left, leftbrackets, right, rightbrackets, dashright, tilderight,
% rightline, rightlinebrackets, dashrightline, tilderightline:
\setbeamertemplate{quotation author}[dashrightline]
\setbeamertemplate{quotation source}[dashrightline]
\defbeamertemplate{quotation begin}{default}{}
\defbeamertemplate{quotation begin}{lines}[1][1pt]{\beamer@horizontal@line@top{quotation line top}{#1}\vskip1ex}
@ -580,13 +611,12 @@
% see definition in /usr/share/texmf/tex/latex/beamer/base/beamerbaselocalstructure.sty
\renewenvironment<>{quotation}[1][]
{ \def\insertquoteauthor{#1}
{ \def\insertquotesource{#1}
\actionenv#2%
\setlength{\beamer@quotation@tmp}{\linewidth}
\beamercolorbox[vmode,wd=\linewidth]{quotation}
\usebeamertemplate{quotation begin}
\usebeamerfont*{quotation}%
\usebeamercolor{quotation}%
\setbox0=\hbox{\usebeamertemplate{quotation symbol}\unskip}%
\ifdim\wd0=0pt
\list{}{
@ -611,7 +641,7 @@
\fi
}
{%
\usebeamertemplate{quotation author}
\usebeamercolor[fg]{quotation source}\usebeamertemplate{quotation source}
\endlist
\setlength{\linewidth}{\beamer@quotation@tmp}
\usebeamertemplate{quotation end}
@ -622,26 +652,26 @@
% quote environment:
\defbeamertemplate{quote symbol}{default}{}
\defbeamertemplate{quote symbol}{openquote}[1][4]{\usebeamercolor[fg]{quote symbol}\openquote[#1]}
\defbeamertemplate{quote symbol}{closequote}[1][4]{\usebeamercolor[fg]{quote symbol}\closequote[#1]}
\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$ }{}}
\defbeamertemplate{quote source}{default}{}
\defbeamertemplate{quote source}{left}{\quote@source@left{quote}{}{}}
\defbeamertemplate{quote source}{leftbrackets}{\quote@source@left{quote}{(}{)}}
\defbeamertemplate{quote source}{right}{\quote@source@right{quote}{}{}}
\defbeamertemplate{quote source}{rightbrackets}{\quote@source@right{quote}{(}{)}}
\defbeamertemplate{quote source}{dashright}{\quote@source@right{quote}{ --- }{}}
\defbeamertemplate{quote source}{tilderight}{\quote@source@right{quote}{ $\sim$ }{}}
\defbeamertemplate{quote source}{rightline}{\quote@source@rightline{quote}{}{}}
\defbeamertemplate{quote source}{rightlinebrackets}{\quote@source@rightline{quote}{(}{)}}
\defbeamertemplate{quote source}{dashrightline}{\quote@source@rightline{quote}{ --- }{}}
\defbeamertemplate{quote source}{tilderightline}{\quote@source@rightline{quote}{ $\sim$ }{}}
% default, left, leftbrackets, right, rightbrackets, dashright, tilderight,
% rightline, rightlinebrackets, dashrightline, tilderightline:
\setbeamertemplate{quote author}[dashrightline]
\setbeamertemplate{quote source}[dashrightline]
\defbeamertemplate{quote begin}{default}{}
\defbeamertemplate{quote begin}{lines}[1][1pt]{\beamer@horizontal@line@top{quote line top}{#1}\vskip1ex}
@ -652,19 +682,18 @@
\setbeamertemplate{quote end}[lines][0.5pt] % default, lines
\renewenvironment<>{quote}[1][]
{ \def\insertquoteauthor{#1}
{ \def\insertquotesource{#1}
\actionenv#2%
\setlength{\beamer@quotation@tmp}{\linewidth}
\beamercolorbox[vmode,wd=\linewidth]{quote}%
\usebeamertemplate{quote begin}%
\usebeamerfont*{quote}%
\usebeamercolor{quote}%
\setbox0=\hbox{\usebeamertemplate{quote symbol}\unskip}%
\ifdim\wd0=0pt
\list{}{
\leftmargin 1em
\rightmargin 1em
\parsep 1ex
\parsep 0.2ex
}%
\item\relax%
\else
@ -672,13 +701,13 @@
\leftmargin 2.5em
\rightmargin 2em
\labelsep 1.5ex
\parsep 1ex
\parsep 0.2ex
}%
\item[\usebeamertemplate{quote symbol}]\relax%
\fi%
}
{%
\usebeamertemplate{quote author}
\usebeamercolor[fg]{quote source}\usebeamertemplate{quote source}
\endlist
\setlength{\linewidth}{\beamer@quotation@tmp}
\usebeamertemplate{quote end}
@ -686,38 +715,6 @@
\endactionenv%
}
% verse environment:
\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] % default, lines
\defbeamertemplate{verse end}{default}{}
\defbeamertemplate{verse end}{lines}[1][1pt]{\beamer@horizontal@line@bottom{verse line bottom}{#1}}
\setbeamertemplate{verse end}[lines][0.5pt] % default, lines
\renewenvironment<>{verse}
{ \actionenv#1%
\setlength{\beamer@quotation@tmp}{\linewidth}
\beamercolorbox[vmode,wd=\linewidth]{verse}
\usebeamertemplate{verse begin}
\usebeamerfont*{verse}%
\usebeamercolor{verse}%
\list{}{
\leftmargin 2em
\rightmargin 2em
\parsep 1ex
}%
\item\relax
}
{%
\endlist
\setlength{\linewidth}{\beamer@quotation@tmp}
\usebeamertemplate{verse end}
\endbeamercolorbox
\endactionenv%
}
%%%%% title page %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%% title page graphic line:
@ -971,10 +968,10 @@
\setbeamerfont{message item}{parent={normal text}, size=\large}
\setbeamerfont{quotation}{shape=\slshape}
\setbeamerfont{quotation author}{parent={normal text}, size=\small, shape=\upshape}
\setbeamerfont{quotation source}{parent={normal text}, size=\small, shape=\upshape}
\setbeamerfont{quote}{shape=\slshape}
\setbeamerfont{quote author}{parent={normal text}, size=\small, shape=\upshape}
\setbeamerfont{quote source}{parent={normal text}, size=\small, shape=\upshape}
\setbeamerfont{verse}{shape=\itshape}

View File

@ -67,22 +67,22 @@
\setbeamertemplate{block theorem begin}[lines]{0.75pt}{0.75pt}
\setbeamertemplate{block theorem end}[lines]{0.75pt}
\setbeamertemplate{verse begin}[lines][0.5pt] % default, lines
\setbeamertemplate{verse end}[lines][0.5pt] % default, lines
% default, left, leftbrackets, right, rightbrackets, dashright, tilderight,
% rightline, rightlinebrackets, dashrightline, tilderightline:
\setbeamertemplate{quotation author}[dashrightline]
\setbeamertemplate{quotation source}[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 source}[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]

View File

@ -348,6 +348,7 @@
\end{block}
\end{frame}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{frame}[fragile]{Quotations}
Quote something of somebody with indentation:
\begin{quotation}[Me And Myself]
@ -359,7 +360,7 @@
Here we even start a second paragraph.
\end{quotation}
\vfill
Quote something else of somebody else (empty author argument):
Quote something else of somebody else (empty source argument):
\begin{quote}
A \verb!quote! environment.
@ -372,6 +373,129 @@
\end{verse}
\end{frame}
\newcommand{\quotedemo}{
\begin{quote}[Me and Myself]
A major insight.
\end{quote}
\vfill
}
\newcommand{\quotesymboldemo}[1]{
\setbeamertemplate{quote symbol}[#1]
\begin{small}
\texttt{\textbackslash setbeamertemplate\{quote symbol\}[#1]}
\end{small}
\quotedemo
}
\begin{frame}[fragile]{Quote symbol settings}
\quotesymboldemo{default}
\quotesymboldemo{openquote}
\quotesymboldemo{closequote}
\begin{alertblock}{}
In the template names, replace \texttt{quote} by
\texttt{quotation} to apply the same changes to the
\texttt{quotation} environment.
\end{alertblock}
\end{frame}
\newcommand{\quotesourcedemo}[1]{
\setbeamertemplate{quote source}[#1]
\begin{small}
\texttt{\textbackslash setbeamertemplate\{quote source\}[#1]}
\end{small}
\quotedemo
}
\begin{frame}[fragile]{Source settings for quote and quotation environments}
Do not print the source:\\
\quotesourcedemo{default}
Left aligned in a new line:\\
\quotesourcedemo{left}
\quotesourcedemo{leftbrackets}
\begin{alertblock}{}
In the template names, replace \texttt{quote} by
\texttt{quotation} to apply the same changes to the
\texttt{quotation} environment.
\end{alertblock}
\end{frame}
\begin{frame}[fragile]{Source settings for quote and quotation environments}
Right aligned in a new line:
\vfill
\quotesourcedemo{right}
\quotesourcedemo{rightbrackets}
\quotesourcedemo{dashright}
\quotesourcedemo{tilderight}
\end{frame}
\begin{frame}[fragile]{Source settings for quote and quotation environments}
Right aligned in the last line:
\vfill
\quotesourcedemo{rightline}
\quotesourcedemo{rightlinebrackets}
\quotesourcedemo{dashrightline}
\quotesourcedemo{tilderightline}
\end{frame}
\newcommand{\quotecolordemo}[2]{
\setbeamercolor{quote line top}{fg=#1}
\setbeamercolor{quote line bottom}{fg=#2}
\begin{small}
\texttt{\textbackslash setbeamercolor\{quote line top\}\{fg=#1\}}\\
\texttt{\textbackslash setbeamercolor\{quote line bottom\}\{fg=#2\}}
\end{small}
\quotedemo
}
\begin{frame}[fragile]{Line settings for quote and quotation environments}
\setbeamertemplate{quote begin}[lines][2pt]
\setbeamertemplate{quote end}[lines][2pt]
\begin{small}
\verb!\setbeamertemplate{quote begin}[lines][2pt]!
\verb!\setbeamertemplate{quote end}[lines][2pt]!
\end{small}
\vfill
\quotecolordemo{}{}
\quotecolordemo{blue}{}
\quotecolordemo{}{blue}
\quotecolordemo{red}{blue}
\end{frame}
\setbeamertemplate{quote begin}[lines][0.5pt]
\setbeamertemplate{quote end}[lines][0.5pt]
\setbeamercolor{quote line top}{fg=}
\setbeamercolor{quote line bottom}{fg=}
\newcommand{\quoteboxdemo}[2]{
\setbeamercolor{quote}{fg=#1, bg=#2}
\begin{small}
\texttt{\textbackslash setbeamercolor\{quote\}\{fg=#1, bg=#2\}}\\
\end{small}
\quotedemo
}
\begin{frame}[fragile]{Colors and fonts for quote and quotation environments}
\setbeamerfont{quote}{size=\tiny, shape=\upshape}
{\small \verb!\setbeamerfont{quote}{size=\tiny, shape=\upshape}!\\}
\quotedemo
\setbeamerfont{quote}{size=\normalsize, shape=\slshape}
\quoteboxdemo{blue}{}
\quoteboxdemo{red}{black!15}
\setbeamercolor{quote}{fg=normal text.fg, bg=black!15}
\setbeamercolor{quote symbol}{fg=green}
{\small \verb!\setbeamercolor{quote symbol}{fg=green}!\\}
\quotedemo
\setbeamercolor{quote symbol}{fg=red}
\setbeamercolor{quote source}{fg=blue}
{\small \verb!\setbeamercolor{quote source}{fg=blue}!\\}
\quotedemo
\setbeamerfont{quote source}{size=\tiny}
{\small \verb!\setbeamerfont{quote source}{size=\tiny}!\\}
\quotedemo
\setbeamercolor{quote source}{fg=}
\end{frame}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\newcommand{\colorpatch}[1]{%
\parbox{10ex}{\centerline{\strut#1}\textcolor{#1}{\rule{10ex}{10ex}}}