From 3416c5679e9cfa1ebba2296ecf401319a9f1cfe6 Mon Sep 17 00:00:00 2001 From: Norbert Preining Date: Mon, 26 Sep 2022 03:03:51 +0000 Subject: CTAN sync 202209260303 --- macros/latex/contrib/abntexto/README | 7 + macros/latex/contrib/abntexto/abntexto-manual.pdf | Bin 0 -> 148750 bytes macros/latex/contrib/abntexto/abntexto-manual.tex | 254 +++++++++ macros/latex/contrib/abntexto/abntexto.cls | 591 +++++++++++++++++++++ macros/latex/contrib/jobname-suffix/README.md | 25 + .../contrib/jobname-suffix/jobname-suffix.pdf | Bin 0 -> 437856 bytes .../contrib/jobname-suffix/jobname-suffix.sty | 134 +++++ .../contrib/jobname-suffix/jobname-suffix.tex | 229 ++++++++ macros/latex/contrib/lettrine/README.md | 6 +- macros/latex/contrib/lettrine/doc/W.pdf | Bin 0 -> 14470 bytes macros/latex/contrib/lettrine/doc/demo-de.pdf | Bin 57807 -> 0 bytes macros/latex/contrib/lettrine/doc/demo-de.tex | 245 --------- macros/latex/contrib/lettrine/doc/demo-fr.pdf | Bin 62734 -> 0 bytes macros/latex/contrib/lettrine/doc/demo-fr.tex | 302 ----------- macros/latex/contrib/lettrine/doc/demo-lua.pdf | Bin 74166 -> 0 bytes macros/latex/contrib/lettrine/doc/demo-lua.tex | 116 ---- .../contrib/lettrine/doc/lettrine-demo-de.pdf | Bin 0 -> 57736 bytes .../contrib/lettrine/doc/lettrine-demo-de.tex | 245 +++++++++ .../contrib/lettrine/doc/lettrine-demo-fr.pdf | Bin 0 -> 62638 bytes .../contrib/lettrine/doc/lettrine-demo-fr.tex | 302 +++++++++++ .../contrib/lettrine/doc/lettrine-demo-lua.pdf | Bin 0 -> 73141 bytes .../contrib/lettrine/doc/lettrine-demo-lua.tex | 116 ++++ macros/latex/contrib/lettrine/doc/lettrine.pdf | Bin 89941 -> 97444 bytes macros/latex/contrib/lettrine/lettrine.dtx | 187 ++++--- macros/latex/contrib/lettrine/lettrine.ins | 2 +- macros/latex/contrib/semantex/README.md | 2 +- macros/latex/contrib/semantex/semantex.pdf | Bin 389783 -> 397503 bytes macros/latex/contrib/semantex/semantex.sty | 349 ++++++++---- macros/latex/contrib/semantex/semantex.tex | 24 +- macros/latex/contrib/semantex/stripsemantex.sty | 2 +- macros/latex/contrib/wargame/README.md | 417 +++++++-------- macros/latex/contrib/wargame/doc/README.md | 417 +++++++-------- macros/latex/contrib/wargame/doc/compat.pdf | Bin 432846 -> 432794 bytes macros/latex/contrib/wargame/doc/symbols.pdf | Bin 184526 -> 184481 bytes macros/latex/contrib/wargame/doc/wargame.pdf | Bin 1305909 -> 1308051 bytes macros/latex/contrib/wargame/source/Makefile | 8 +- macros/latex/contrib/wargame/source/hex/core.dtx | 1 + macros/latex/contrib/wargame/source/util/core.dtx | 99 ++-- .../latex/contrib/wargame/source/utils/export.py | 226 +++++++- 39 files changed, 2970 insertions(+), 1336 deletions(-) create mode 100644 macros/latex/contrib/abntexto/README create mode 100644 macros/latex/contrib/abntexto/abntexto-manual.pdf create mode 100644 macros/latex/contrib/abntexto/abntexto-manual.tex create mode 100644 macros/latex/contrib/abntexto/abntexto.cls create mode 100644 macros/latex/contrib/jobname-suffix/README.md create mode 100644 macros/latex/contrib/jobname-suffix/jobname-suffix.pdf create mode 100644 macros/latex/contrib/jobname-suffix/jobname-suffix.sty create mode 100644 macros/latex/contrib/jobname-suffix/jobname-suffix.tex create mode 100644 macros/latex/contrib/lettrine/doc/W.pdf delete mode 100644 macros/latex/contrib/lettrine/doc/demo-de.pdf delete mode 100644 macros/latex/contrib/lettrine/doc/demo-de.tex delete mode 100644 macros/latex/contrib/lettrine/doc/demo-fr.pdf delete mode 100644 macros/latex/contrib/lettrine/doc/demo-fr.tex delete mode 100644 macros/latex/contrib/lettrine/doc/demo-lua.pdf delete mode 100644 macros/latex/contrib/lettrine/doc/demo-lua.tex create mode 100644 macros/latex/contrib/lettrine/doc/lettrine-demo-de.pdf create mode 100644 macros/latex/contrib/lettrine/doc/lettrine-demo-de.tex create mode 100644 macros/latex/contrib/lettrine/doc/lettrine-demo-fr.pdf create mode 100644 macros/latex/contrib/lettrine/doc/lettrine-demo-fr.tex create mode 100644 macros/latex/contrib/lettrine/doc/lettrine-demo-lua.pdf create mode 100644 macros/latex/contrib/lettrine/doc/lettrine-demo-lua.tex (limited to 'macros/latex') diff --git a/macros/latex/contrib/abntexto/README b/macros/latex/contrib/abntexto/README new file mode 100644 index 0000000000..1ca1cc0bee --- /dev/null +++ b/macros/latex/contrib/abntexto/README @@ -0,0 +1,7 @@ +Public Domain Software +2022-09-25 +1.0.0-alpha +Elayson +elaysonabreu@gmail.com + +abntexto is a LaTeX class for the elaboration of academic works according to the guidelines of the Associação Brasileira de Normas Técnicas (ABNT). \ No newline at end of file diff --git a/macros/latex/contrib/abntexto/abntexto-manual.pdf b/macros/latex/contrib/abntexto/abntexto-manual.pdf new file mode 100644 index 0000000000..236d447268 Binary files /dev/null and b/macros/latex/contrib/abntexto/abntexto-manual.pdf differ diff --git a/macros/latex/contrib/abntexto/abntexto-manual.tex b/macros/latex/contrib/abntexto/abntexto-manual.tex new file mode 100644 index 0000000000..2038eed5d1 --- /dev/null +++ b/macros/latex/contrib/abntexto/abntexto-manual.tex @@ -0,0 +1,254 @@ +\documentclass{abntexto} + +\makeatletter + +\usepackage[brazil]{babel} +\usepackage[T1]{fontenc} +\usepackage[varqu,varl,scale=0.85]{inconsolata} +\usepackage[matchlowercase]{tgheros} \renewcommand\familydefault\sfdefault +\usepackage{lipsum} \def\lip{\lipsum[1][1-2]} +\usepackage{graphicx} +\usepackage{xcolor} +\usepackage[colorlinks]{hyperref} + +% MARKUP DEFS +% ================================================ + +\def\cs#1{{\ttfamily \string#1}} +\def\meta#1{\textsf{⟨\textit{\fontseries{c}\selectfont #1}⟩}} % ⟨#1⟩ +\def\cc#1{{\ttfamily \{\meta{#1}\}}} +\def\kk#1{{\ttfamily [\meta{#1}]}} + +\def\arg{\cc{arg}} +\def\opt{\kk{opt}} +\def\argi{\cc{argi}} +\def\argii{\cc{argii}} +\def\argiii{\cc{argiii}} +\def\opti{\kk{opti}} +\def\optii{\kk{optii}} +\def\optiii{\kk{optiii}} +\def\ccval#1{{\ttfamily \{#1\}}} +\def\kkval#1{{\ttfamily [#1]}} +\def\cls#1{\textsf{\textit{#1}}} +\def\pkg#1{\texttt{#1}} + +% VERBATIM +% ================================================ + +\def\adef#1{\catcode`#1=13 \begingroup \lccode`\~=`#1\lowercase{\endgroup\def~}} +\def\dodef#1{\catcode`#1=12 } +\def\verbcatcodes{\let\do=\dodef \dospecials\obeyspaces\catcode`\%=14 } + +\long\def\verbon{\par\begingroup \verbcatcodes + \catcode`\|=0 % escape char + \adef\^^I{\space\space\space\space}\adef\^^M{\par\leavevmode}% + \startverb +} +{\catcode`\|=0 \catcode`\\=12 + |long|gdef|startverb#1\verboff{|verbbox{#1}|par|endgroup |verbreset} +} +\def\verbbox#1{\def\tnba@placewidth{\hsize \advance\hsize-3cm}% + \ifx\tnba@savedplace\empty \else \vskip\placeabovespace \fi + \parindent=0pt + \ifx\tnba@savedplace\empty\else\tnba@makelegend\fi + \nobreak\par\nointerlineskip \kern10pt + {\verbfont{#1}}% + \nobreak\nointerlineskip + \ifx\tnba@savedsrc\empty \else \tnba@makesrc \vskip\placebelowspace \fi +} +\def\verbreset{% + \let\tnba@savedplace=\empty + \let\tnba@savedlegend=\empty + \let\tnba@savedsrc=\empty + \let\@currentlabel=\relax +} +\long\def\verbfont{\raggedright\leftskip=6pt \singlesp\ttfamily\@noligs\leftframed} +\long\def\leftframed#1{\setbox0=\vtop{#1}% + \hbox{{\color{graybar}\kern1.5cm\vrule width1pt}\box0}% +} + +% PERSONAL DEFS +% ================================================ + +\sizeselectordef\large{14pt}{17pt} +\sizeselectordef\Large{22pt}{25pt} +\sizeselectordef\LARGE{25pt}{30pt} + +\definecolor{graybar}{gray}{0.75} +\definecolor{graycomment}{gray}{0.55} + +\legendplacedef{verb}{Verbatim}{verb.\,#1}{lov} + +\def\me{o autor.} + +\tocilowercase +\sectionlowercase + +\clubpenalty=10000 +\widowpenalty=10000 + +\makeatother + + + +\begin{document} + +\leavevmode\vskip1.9in + +{\centering \LARGE\sffamily\bfseries + abntexto\\[0.4em] \Large\itshape\mdseries + Classe para {\upshape\LaTeX}\\[2em] \normalfont\large + Elayson\\[1ex] + \href{mailto:elaysonabreu@gmail.com}{elaysonabreu@gmail.com}\\[2.5ex] + \today\par} + +\vskip3in + +{\centering \large\ttfamily 1.0.0-alpha\par} + +\newpage + +\maketoc + +\textual + +\section{Apresentação} + +O \cls{abntexto} é uma classe do \LaTeX\ criada para facilitar a utilização das normas da Associação Brasileira de Normas Técnicas (ABNT) em trabalhos acadêmicos (monografias, dissertações, teses). + +Este \emph{não} é um manual sobre \LaTeX\ (ou \TeX, a ferramenta que o constitui) nem tampouco uma descrição detalhada sobre as normas ABNT. Para aprender sobre \LaTeX\ leia \href{https://www.ctan.org/pkg/latex-via-exemplos}{\LaTeXe\ Via Exemplos} ou \href{https://www.ctan.org/pkg/latex2e-help-texinfo}{\LaTeXe: An unofficial reference manual}, disponível também em francês. Além disso, também se pode ler \href{https://www.ctan.org/pkg/texbytopic}{\TeX\ by Topic} para aprender sobre o sistema \TeX. + +Já existe uma classe para aplicação das normas ABNT cujo nome é \cls{abntex2}. Mas, diferente desta, o \cls{abntexto} não depende do \cls{memoir}, uma classe de código-fonte e manual extensos e que implementa funções as quais, em sua maioria, não são pertinentes a um documento que use as diretrizes da ABNT. + +As normas ABNT as quais o \cls{abntexto} se propõe a seguir são aquelas em vigor até o momento da criação deste manual. + +\section{Chamando a classe} + +Digite as linhas em \ref{vb:início} e use \cls{abntexto}. + +\legend{verb}{Início} \src\me +\label{vb:início} +\verbon +\documentclass{abntexto} + +\usepackage[brazil]{babel} |% para obter os padrões de hifenização corretos +\usepackage[T1]{fontenc} +\usepackage{newtxtext} |% fontes New TX, com estilo times +\usepackage{newtxmath} + +\begin{document} + Texto +\end{document}% +\verboff + +\section{Fonte tipográfica} + +O tamanho da fonte é 12\,pt de imediato e pode ser configurado com o comando \cs\setfontsize\arg\ sendo que 12\,pt é a única opção disponível. Mas, se você deseja outro tamanho de fonte, crie-o usando \cs\fontsizedef\cc{size}\cc{defs}. Além disso, com os seletores de tamanho \cs\normalsize\ e \cs\small\ que configuram 12\,pt e 10\,pt, nessa ordem, é possível mudar o tamanho da fonte no corpo do documento. + +O espaçamento é de um e meio e pode ser alterado para dois com \cs\spacing\ccval{2}, por exemplo. Os atalhos \cs\singlesp, \cs\onehalfsp\ e \cs\doublesp\ estão disponíveis. Note que o espaçamento simples não tem o mesmo valor que o espaçamento um, portanto, \cs\singlesp\ é diferente de \cs\spacing\ccval{1}! Os atalhos \cs\onehalfsp\ e \cs\doublesp\ tem o mesmo significado de \cs\spacing\ccval{1.5} e \cs\spacing\ccval{2}. + +\section{\emph{Layout}} + +A folha é A4 por padrão e as margens esquerda e direita são de 3\,cm, 2\,cm para páginas ímpares e de 2\,cm, 3\,cm para páginas pares, respectivamente. Além disso, as margens superior e inferior têm, nessa ordem, 3\,cm, 2\,cm para todo o documento. Todas essas medidas podem ser alteradas com a macro \cs\paper\ que deve ser usada assim: \cs\paper\ccval{left=0cm,right=0cm,top=0cm,botttom=0cm}. + +Além das chaves anteriores também existe \cs{twoside} que é booleana, ou seja, aceita os valores \cs{true} ou \cs{false} e serve para ativar o modo de impressão em duas folhas aonde as medidas das margens horizontais se invertem nas páginas pares. Ao não informar um valor para \cs{twoside} subentende-se que seja \cs{true}, portanto \cs\paper\ccval{twoside} equivale a \cs\paper\ccval{twoside=true} e esse princípio também se aplica a outras chaves booleanas. + +\section{Sumário} + +Os comandos que mudam a fonte das entradas no ToC (Table of Contents, em inglês) são \cs\tocifont, \cs\tociifont, \dots, \cs\tocvfont\ (ver \ref{vb:contents}). + +\legend{verb}{Aparência do sumário} \src\me +\label{vb:contents} +\verbon +\documentclass{abntexto} + +\usepackage{color} + +\tocifont{\color{red}\itshape} +\tociifont{\color{blue}\bfseries} + +\begin{document} + \maketoc + + \section{Título} + \subsection{Título} +\end{document}% +\verboff + +\section{Secionamento} + +A personalização das macros de seção (\cs\section, \cs\subsection\ etc.) é análoga a personalização do sumário e deve ser feita com \cs\sectionfont, \cs\subsectionfont, etc. como exemplificado em \ref{vb:sec}. + +Também há como alterar o espaço vertical acima e abaixo das seções usando \cs\sectionspaces, \cs\subsectionspaces, etc. Por exemplo, \cs\sectionspaces\ccval{2ex}\ccval{1cm} insere um espaço de 2ex acima de \cs\section\ e 1cm abaixo. + +\legend{verb}{Aparência das seções} \src\me +\label{vb:sec} +\verbon +\documentclass{abntexto} + +\usepackage{color} + +\sectionfont{\color{blue}\scshape} +\subsectionfont{\color{red}\slshape} +\subsubsectionfont{\color{yellow}\sffamily} + +\begin{document} + \maketoc + + \section{Texto} + \subsection{Texto} + \subsubsection{Texto} +\end{document}% +\verboff + +\section{Alíneas} + +Use o ambiente \cs{topics} para criar alíneas. Ele dispõe de dois níveis sendo que o segundo usa um travessão como marcador conforme o exemplo em \ref{vb:topics}. Naturalmente o uso de \cs\label\ é permitido. + +\legend{verb}{Alíneas} \src\me +\label{vb:topics} +\verbon +\begin{topics} + \item \label{alínea:x} 1 + \begin{topics} + \item x + \item y + \item z + \end{topics} + \item \label{alínea:y} 2 + \item 3 +\end{topics}% +\verboff + +\section{Áreas de legenda} + +Use \cs\place\ para inserir áreas de legenda como mostrado em \ref{vb:place}. Mas existem condições: \cs\place\ deve vir por último e \cs\label\ precisa estar depois de \cs\legend. Além disso, existe a possibilidade de alterar o espaço vertical acima e abaixo de uma área de legenda com \cs\placespaces\cc{aboveskip}\cc{belowskip}. + +\legend{verb}{Áreas de legenda} \src\me +\label{vb:place} +\verbon +\usepackage{graphicx} + +\begin{document} + \legend{figure}{Um título} + \src{\texttt{www.site.com.br}. Acesso em 01 jan. 2020.} + \label{fig:teste} + \place{\includegraphics[width=0.4\linewidth]{example-image}} + + Ver \ref{fig:teste}. +\end{document}% +\verboff + +\section{Formatação de {\ttfamily\protect\textbackslash cite} e referências} + +Até o momento esta classe não possui macros para formatação de \cs\cite\ e referências. Utilize \cs{\usepackage\{abnt2cite\}} ou \cs{\usepackage[style=abnt]\{biblatex\}}. + +\section{Citações} + +Para inserir aspas em citações diretas use \cs\qt\cc{texto}. Mas, se tratando de citações diretas com mais de três linhas, alterne para \cs\quote\ccval{enquoted text \cs\cite\cc{key}}. + +\section{Código-fonte} + +Em progresso\dots + +\end{document} diff --git a/macros/latex/contrib/abntexto/abntexto.cls b/macros/latex/contrib/abntexto/abntexto.cls new file mode 100644 index 0000000000..09e3cf9750 --- /dev/null +++ b/macros/latex/contrib/abntexto/abntexto.cls @@ -0,0 +1,591 @@ +%! Public Domain Software +%! 2022-09-25 +%! 1.0.0-alpha +%! Elayson +%! elaysonabreu@gmail.com + +%! SUMÁRIO + +%! PRÉ-CONFIGURAÇÕES +%! FONTES +%! LAYOUT +%! SUMÁRIO +%! SECIONAMEMTO +%! CITAÇÕES +%! ALÍNEAS +%! TABELAS +%! ÁREAS DE LEGENDA +%! UTILIDADES +%! IDENTIFICAÇÃO DO TRABALHO +%! PATCHS, HOOKS +%! INICIALIZAÇÃO + +% |sec PRÉ-CONFIGURAÇÕES +% !======================================================= + +% Identificação do formato |TeX| e da classe. Apenas o pacote |pkg=keyval= é carregado nesta classe. + +% |bcode !------------------------------------------------ +\NeedsTeXFormat{LaTeX2e} + +\ProvidesClass{abntexto}[2022-09-25 1.0.0-alpha Preparation of works in ABNT standards] + +\RequirePackage{keyval} +% |ecode !------------------------------------------------ + +% Macros auxiliares e sistema |dest==. + +\ifx\csstring\undefined + \def\tnba@csstring#1{\expandafter\tnba@csstringA\string#1//} + \def\tnba@csstringA#1#2//{#2} +\else + \let\tnba@csstring=\csstring +\fi + +% Definição do sistema |dest=keyval= e de um comando de |dest=debug=. + +% |bcode !------------------------------------------------ +\def\tnba@keyprefix{tnba} + +\def\tnba@key{\define@key{\tnba@keyprefix @\tnba@keyfamily}} +\def\tnba@setkeys{\setkeys{\tnba@keyprefix @\tnba@keyfamily}} +\def\tnba@setmacrokeys#1{\setkeys{\tnba@keyprefix @#1}} + +\def\advancecount#1{\global\advance#1by1 } +\edef\tnba@bslash{\tnba@csstring\\} +\def\tnba@addto#1#2{\expandafter\def\expandafter#1\expandafter {#1#2}} +\def\tnba@tobdocument{\tnba@addto\tnba@bdocumenthook} + +\AddToHook{begindocument}{\def\tnba@bdocument{}} + +\def\tnba@error{\ClassError{abntexto}} +% |ecode !------------------------------------------------ + +% |sec FONTES +% !================================================ + +\def\tnba@inputfonts#1{\@namedef{tnba@fonts@#1}} + +\tnba@inputfonts{Latin Modern}{\usepackage{amssymb,lmodern,bm}} + +\tnba@inputfonts{helvetica-clone}{\def\sfdefault{qhv}\def\familydefault{\sfdefault}} +\tnba@inputfonts{palatino-clone}{\usepackage{newpxtext,newpxmath,bm}} +\tnba@inputfonts{timesnewroman-clone}{\usepackage{newtxtext,newtxmath,bm}} + +\def\fonts#1{\ifcsname tnba@fonts@#1\endcsname + \csname tnba@fonts@#1\endcsname \else + \tnba@error{Fonte *#1* desconhecida}\relax \fi +} + +% Apenas o tamanho 12|,pt está definido. Defina outros usando |cs=fontsizedef=|metac=size=|metac=defs=. + +% |bcode !------------------------------------------------ +\def\fontsizedef#1#2{\@namedef{tnba@fontsize@#1}{#2}} +\def\sizeselectordef#1#2#3{\DeclareRobustCommand#1{\@setfontsize#1{#2}{#3}}} +\def\setfontsize#1{\ifcsname tnba@fontsize@#1\endcsname + \def\tnba@setfontsizehook{\csname tnba@fontsize@#1\endcsname} \else + \let\normalsize=\relax + \tnba@error{Tamanho de fonte *#1* desconhecido}{}\relax \fi +} + +\AddToHook{begindocument/before}{\tnba@setfontsizehook} +% |ecode !------------------------------------------------ + +\def\spacing#1{\ifx\tnba@bdocument\undefined + \def\tnba@spacinghook{\tnba@spacing{#1}} \else + \tnba@spacing{#1}\fi \ignorespaces +} +\def\tnba@spacing#1{\dimen0=\f@size pt \dimen0=#1\dimen0 \baselineskip=\dimen0 } + +\def\singlesp{\baselineskip=\normalbaselineskip} +\def\onehalfsp{\spacing{1.5}} +\def\doublesp{\spacing{2}} + +\AddToHook{begindocument}{\csname tnba@spacinghook\endcsname} + +% LAYOUT +% ================================================ + +\def\tnba@keyfamily{paper} + +\def\papersizedef#1(#2,#3){\def\tnba@keyfamily{paper}% + \tnba@key{#1}[]{\def\tnba@W{#2}\def\tnba@H{#3}}% +} + +\tnba@key{width} {\def\tnba@W{#1}} +\tnba@key{height} {\def\tnba@H{#1}} +\tnba@key{left} {\def\tnba@L{#1}} +\tnba@key{right} {\def\tnba@R{#1}} +\tnba@key{top} {\def\tnba@T{#1}} +\tnba@key{bottom} {\def\tnba@B{#1}} +\tnba@key{twoside}[true]{\def\tnba@twoside{#1}} + +\def\paper#1{\tnba@setmacrokeys{paper}{#1}% + \paperwidth=\tnba@W + \paperheight=\tnba@H + \oddsidemargin=\tnba@L + \evensidemargin=\tnba@R + \topmargin=\tnba@T + \textwidth=\paperwidth + \textheight=\paperheight + \headheight=12pt + \headsep=1cm + \advance\topmargin-\headheight \advance\topmargin-\headsep + \advance\textwidth-\tnba@L \advance\textwidth-\tnba@R + \advance\textheight-\tnba@T \advance\textheight-\tnba@B + \advance\headsep-\fontcharht\font`1 + \ifx\pdfpagewidth\undefined + \ifx\pagewidth\undefined + \tnba@error{O comando \tnba@bslash paper só suporta saída em PDF. Use o formato PDF ou carregue o pacote *geometry*}\expandafter\enddocument\relax \else + \horigin=0pt + \vorigin=0pt + \pagewidth=\paperwidth + \pageheight=\paperheight + \fi + \else + \ifx\pdfhorigin\undefined + \advance\oddsidemargin-1in + \advance\topmargin-1in + \pdfpagewidth=\paperwidth + \pdfpageheight=\paperheight + \else + \pdfhorigin=0pt + \pdfvorigin=0pt + \pdfpagewidth=\paperwidth + \pdfpageheight=\paperheight + \fi + \fi + \ifx\tnba@twoside\undefined \else + \csname @twoside\tnba@twoside\endcsname \fi +} + +\def\pretextual{\paper{twoside=false}% + \let\@oddhead=\empty + \let\@evenhead=\empty + \let\@oddfoot=\empty + \let\@evenfoot=\empty +} +\def\textual{\paper{twoside=true}% + \def\@oddhead{{\itshape\rightmark}\hfil{\small\thepage}}% + \def\@evenhead{{\small\thepage}\hfil\itshape\leftmark}% + \let\@oddfoot=\empty + \let\@evenfoot=\empty + \justifying + \parindent=1.5cm +} + +% SUMÁRIO +% ================================================ + +\def\thepage{\the\c@page} +\def\noprotrusion{\kern-1pt\kern1pt} +\def\extfile#1{\@starttoc{#1}} + +\def\extline#1#2#3#4{% + \begingroup + \csname use#1\romannumeral#2font\endcsname \nobreak + \extlineshape + \hskip-\leftskip {#3}\nobreak + \leaders\hbox{$\m@th \mkern4.5mu\hbox{.}\mkern4.5mu$}\hfil\nobreak + \hbox to1.55em{\hss #4\noprotrusion}\par + \endgroup +} +\def\extlineshape{% + \parindent=0pt + \leftskip=\extlabelwidth + \rightskip=2.55em + \parfillskip=-\rightskip + \interlinepenalty=10000 + \leavevmode +} + +\def\l@section#1#2{\smartaboveskip{\penalty351}{\vskip1em plus1pt}% + \begingroup + \usetocifont \nobreak + \extlineshape + \hskip-\leftskip \maybeuctoc{#1}\nobreak\hfil\nobreak + \hbox to1.55em{\hss #2\noprotrusion}\par + \endgroup +} +\def\l@subsection {\extline{toc}{2}} +\def\l@subsubsection {\extline{toc}{3}} +\def\l@paragraph {\extline{toc}{4}} +\def\l@subparagraph {\extline{toc}{5}} + +\def\tocifont#1{\def\usetocifont{#1}} +\def\tociifont#1{\def\usetociifont{#1}} +\def\tociiifont#1{\def\usetociiifont{#1}} +\def\tocivfont#1{\def\usetocivfont{#1}} +\def\tocvfont#1{\def\usetocvfont{#1}} + +% SECIONAMENTO +% ================================================ + +\def\tnba@nbpar{\interlinepenalty=10000\par} +\def\noindentfirst{\global\everypar={\tnba@wipeepar \setbox7=\lastbox}} +\def\tnba@wipeepar{\global\everypar={}} + +\newskip\savedtitleskip +\newskip\savedlastskip + +\def\smartaboveskip#1#2{\savedlastskip=\lastskip + \ifdim\lastskip>\z@ \vskip-\lastskip \fi + \ifnum\lastpenalty=11333 \vskip-\savedtitleskip \else #1\fi + \ifdim\savedlastskip>\z@ \setbox0=\vbox{#2\global\dimen0=\lastskip}% + \else \dimen0=\maxdimen \fi + \ifdim\savedlastskip>\dimen0 \vskip\savedlastskip \else #2\fi +} +\def\smartbelowskip#1{#1\global\savedtitleskip=\lastskip \penalty11333} + +\newcount\sectioncount +\newcount\subsectioncount +\newcount\subsubsectioncount +\newcount\paragraphcount +\newcount\subparagraphcount + +\def\thesection{\the\sectioncount} +\def\thesubsection{\thesection .\the\subsectioncount} +\def\thesubsubsection{\thesubsection .\the\subsubsectioncount} +\def\theparagraph{\thesubsubsection .\the\paragraphcount} +\def\thesubparagraph{\theparagraph .\the\subparagraphcount} + +\def\sectionmark#1{} +\def\subsectionmark#1{} +\def\subsubsectionmark#1{} +\def\paragraphmark#1{} +\def\subparagraphmark#1{} + +\def\section#1{\par \smartaboveskip{\penalty351}{\vskip\sectionabove}\noindent + \advancecount\sectioncount + \setbox0=\hbox{\usesectionfont \thesection\quad}% + {\usesectionfont \hangindent=\wd0 \box0 \maybeucsec{#1}\tnba@nbpar}% +% \noindentfirst + \addcontentsline{toc}{section}{\protect\extlabelbox{\thesection\hss}#1}% + \nobreak \smartbelowskip{\vskip\sectionbelow}% +} +\def\subsection#1{\par \smartaboveskip{\penalty351}{\vskip\subsectionabove}\noindent + \advancecount\subsectioncount + \setbox0=\hbox{\usesubsectionfont \thesubsection\quad}% + {\usesubsectionfont \hangindent=\wd0 \box0 #1\tnba@nbpar}% +% \noindentfirst + \addcontentsline{toc}{subsection}{\protect\extlabelbox{\thesubsection\hss}#1}% + \nobreak \smartbelowskip{\vskip\subsectionbelow}% +} +\def\subsubsection#1{\par \smartaboveskip{\penalty351}{\vskip\subsubsectionabove}\noindent + \advancecount\subsubsectioncount + \setbox0=\hbox{\usesubsubsectionfont \thesubsubsection\quad}% + {\usesubsubsectionfont \hangindent=\wd0 \box0 #1\tnba@nbpar}% +% \noindentfirst + \addcontentsline{toc}{subsubsection}{\protect\extlabelbox{\thesubsubsection\hss}#1}% + \nobreak \smartbelowskip{\vskip\subsubsectionbelow}% +} +\def\paragraph#1{\par \smartaboveskip{\penalty351}{\vskip\paragraphabove}\noindent + \advancecount\paragraphcount + \setbox0=\hbox{\useparagraphfont \theparagraph\quad}% + {\useparagraphfont \hangindent=\wd0 \box0 #1\tnba@nbpar}% +% \noindentfirst + \addcontentsline{toc}{paragraph}{\protect\extlabelbox{\theparagraph\hss}#1}% + \nobreak \smartbelowskip{\vskip\paragraphbelow}% +} +\def\subparagraph#1{\par \smartaboveskip{\penalty351}{\vskip\subparagraphabove}\noindent + \advancecount\subparagraphcount + \setbox0=\hbox{\subsubparagraphfont \thesubparagraph\quad}% + {\usesubparagraphfont \hangindent=\wd0 \box0 #1\tnba@nbpar}% +% \noindentfirst + \addcontentsline{toc}{subparagraph}{\protect\extlabelbox{\thesubparagraph\hss}#1}% + \nobreak \smartbelowskip{\vskip\subparagraphbelow}% +} + +\def\heading#1{\noindent + {\usesectionfont \centering \maybeucsec{#1}\tnba@nbpar}% +% \noindentfirst + \nobreak \vskip\sectionbelow +% \addcontentsline{toc}{section}{\hbox to\extlabelwidth{}\maybeuctoc{#1}}% +} + +\def\tociuppercase{\def\maybeuctoc{\MakeUppercase}} +\def\tocilowercase{\let\maybeuctoc=\relax} +\def\sectionuppercase{\def\maybeucsec{\MakeUppercase}} +\def\sectionlowercase{\let\maybeucsec=\relax} + +\def\sectionfont#1{\def\usesectionfont{#1}} +\def\subsectionfont#1{\def\usesubsectionfont{#1}} +\def\subsubsectionfont#1{\def\usesubsubsectionfont{#1}} +\def\paragraphfont#1{\def\useparagraphfont{#1}} +\def\subparagraphfont#1{\def\usesubparagraphfont{#1}} + +\def\sectionspaces#1#2{\def\sectionabove{#1}\def\sectionbelow{#2}} +\def\subsectionspaces#1#2{\def\subsectionabove{#1}\def\subsectionbelow{#2}} +\def\subsubsectionspaces#1#2{\def\subsubsectionabove{#1}\def\subsubsectionbelow{#2}} +\def\paragraphspaces#1#2{\def\paragraphabove{#1}\def\paragraphbelow{#2}} +\def\subparagraphspaces#1#2{\def\subparagraphabove{#1}\def\subparagraphbelow{#2}} + +% CITAÇÕES +% ================================================ + +\def\qt#1{``#1''} + +\def\quote#1{\smartaboveskip{\penalty351}{\vskip\baselineskip}% +\hfill\vtop{\advance\hsize-4cm \noindent\small #1\getprev}\useprev + \smartbelowskip{\vskip\baselineskip}% +} + +% ALÍNEAS +% ================================================ + +\newcount\topicsdepth +\newcount\topicscount + +\def\topicsindenti{\advance\leftskip\topicslabelwidth} +\def\topicsindentii{\advance\leftskip\topicslabelwidth \advance\leftskip\topicslabelwidth} +\def\topicslabelwidth{4ex} + +\def\topicsitem{\par\leavevmode\noindent \advance\topicscount by1 + \def\@currentlabel{alínea~\@alph\topicscount )}% + \kern\dimexpr-\parindent-\topicslabelwidth\relax + \hbox to\topicslabelwidth{\topicsmakelabel\hfil}% + \ignorespaces +} +\def\topicslabeli{\@alph\topicscount )} +\def\topicslabelii{---} + +\def\topics{\par \advance\topicsdepth by1 + \leftskip=\parindent + \csname topicsindent\romannumeral\topicsdepth\endcsname + \edef\topicsmakelabel{\expandafter\noexpand\csname topicslabel\romannumeral\topicsdepth\endcsname}% + \let\item=\topicsitem + \tnba@addto\@esphack\ignorespaces +} + +\let\endtopics=\par + +% |sec TABELAS +% ! ================================================ + +\newenvironment{table}[1]{\begin{tabular}{#1}}{\end{tabular}} + +% ÁREAS DE LEGENDA +% ================================================ + +%\long\def\@makecaption#1#2{\sbox0{#1~—~#2}% +% \ifdim\wd0>\hsize +% #1~—~#2\par \else +% \global\@minipagefalse \hbox to\hsize{\hss\box0\hss}% +% \fi +% \vskip10pt +%} +%\def\place#1#2#3{\@float{#1}\centering\caption{#2}#3\end@float} + +\def\tnba@lastplacenum{0} + +% \legendplacedef{}{}{}{} +\def\legendplacedef#1#2#3#4{\expandafter\newcount\csname c@#1\endcsname + \@namedef{#1name}{#2} + \@namedef{p@#1}##1{#3} + \@namedef{ext@#1}{#4} + \@namedef{l@#1}{\extline{#4}{1}} + \expandafter\edef\csname the#1\endcsname{\expandafter\noexpand\the\csname c@#1\endcsname} +% \tnba@key{pos}{\@namedef{fps@#1}{##1}} +% \@nameedef{ftype@#1}{\the\numexpr\tnba@lastplacenum+1} +% \@namedef{fnum@#1}{\csname #1name\endcsname ~\csname the#1\csname} +} + +\def\tnba@makelegend{\advancecount{\csname c@\tnba@savedplace\endcsname}% + \hfil \hbox{\vtop{\setbox0=\hbox{\legendlabel \tnba@savedlegend}% + \ifdim\wd0>\legendmaxwidth \hsize=\legendmaxwidth \else \hsize=\wd0 \fi + \setbox0=\hbox{\legendlabel}\legendlabel + \vtop{\advance\hsize-\wd0 \tnba@savedlegend}% + }}% + \addcontentsline{\csname ext@\tnba@savedplace\endcsname}% + {\tnba@savedplace}% + {\protect\extlabelbox\thelegend \tnba@savedlegend}% +} +\def\tnba@makesrc{\vskip8pt + \hfil \hbox{\vtop{\hsize=\tnba@placewidth + \setbox0=\hbox{\srclabel}\srclabel + \vtop{\advance\hsize-\wd0 \tnba@savedsrc\getprev}% + }}\useprev +} + +\def\legend#1#2{% + \ifdim\lastskip<0pt \else + \ifnum\lastpenalty=11333 \vskip-\placeabovespace \else + \removelastskip \fi\fi + \def\tnba@savedplace{#1}\def\tnba@savedlegend{#2}% + \def\@currentlabel{\csname p@#1\expandafter\endcsname + \the\expandafter\numexpr\csname c@#1\endcsname+1}% +} +\def\legendname{\csname \tnba@savedplace name\endcsname} +\def\thelegend{\the\csname c@\tnba@savedplace\endcsname} + +\def\src#1{% + \ifdim\lastskip<0pt \else + \ifnum\lastpenalty=11333 \vskip-\placeabovespace \else + \removelastskip \fi\fi + \def\tnba@savedsrc{#1}% +} +\def\srcname{Fonte} + +\def\placespaces#1#2{\def\placeabovespace{#1}\def\placebelowspace{#2}} + +\let\tnba@savedplace=\empty +\let\tnba@savedlegend=\empty +\let\tnba@savedsrc=\empty + +\long\def\place#1{% + \ifx\tnba@savedplace\empty \else \vskip\placeabovespace \fi + \begingroup \setbox0=\hbox{\ignorespaces#1}\edef\tnba@placewidth{\the\wd0}% + \parindent=0pt + \ifx\tnba@savedplace\empty\else\tnba@makelegend\fi + \nobreak\par\nointerlineskip + \hbox to\hsize{\hss\box0\hss}% + \nobreak\par\nointerlineskip + \ifx\tnba@savedsrc\empty \else \tnba@makesrc \vskip\placebelowspace \fi +\par + \endgroup + \let\tnba@savedplace=\empty + \let\tnba@savedlegend=\empty + \let\tnba@savedsrc=\empty + \let\@currentlabel=\relax +} + +% UTILIDADES +% ================================================ + +\def\getprev{\par\xdef\tnba@getprevA{\the\prevdepth}} +\def\useprev{\par\prevdepth=\tnba@getprevA} + +\long\def\sizedpar#1{\leavevmode\vtop{\ignorespaces#1\getprev}\useprev} + +\def\justifying{\let\\=\tnba@origcr + \leftskip=0pt \rightskip=0pt + \finalhyphendemerits=5000 + \parfillskip=0pt plus1fil +} +\let\tnba@origcr=\\ + +\def\Enter{\@ifnextchar[\tnba@EnterS{\tnba@EnterS[]}} +\def\tnba@EnterS[#1]{\vskip#1\baselineskip} + +\def\twonewpage{\newpage\leavevmode\newpage} + +% IDENTIFICAÇÃO DO TRABALHO +% ================================================ + +%\long\def\indexcarddebug#1{\hbox{\vrule\vbox to7.5cm{\hsize=\hsize %\advance\hsize-2cm \advance\hsize-0.8pt +% \hrule\indexcardA{#1}\vss\indexcardbar\hrule}\vrule}% +%} +%\long\def\indexcarddebugA#1{\hbox spread2cm{\hss\vrule +% \vbox spread2cm{\hrule\vss#1\vss\hrule}\vrule\hss}% +%} + +\long\def\indexcard#1{\hbox{\vrule\vbox to7.5cm{\hsize=12.5cm \advance\hsize by-2cm \advance\hsize by-0.8pt + \hrule\indexcardA{#1}\vss\indexcardbar\hrule}\vrule}% +} +\long\def\indexcardA#1{\hbox spread2cm{\hss\vbox spread2cm{\vss\ttfamily#1\vss}\hss}% +} +\def\indexcardbar{\hrule\kern1cm} + +\def\judgeline#1{\par{\centering \rule{.7\linewidth}{.6pt}\\ #1\Enter[1.5]}} + +% |sec ? +% ! ================================================ + +{\catcode`,=\active + \gdef,{\futurelet\next\tnba@smartcomma} +} + +\def\tnba@smartcomma{% + \ifx\next\@sptoken \else + \ifx\next\space \else \mathord \fi\fi + \tnba@mathcomma +} + +\mathchardef\tnba@mathcomma\mathcode`\, +\mathcode`\,="8000 + +\ifx\XeTeXversion\undefined +\AddToHook{begindocument/before}{ + \let\tnba@hyper@linkstart=\hyper@linkstart + \protected\def\hyper@linkstart#1#2{\lowercase{\tnba@hyper@linkstart{#1}{#2}}} +} +\fi + +% |sec INICIALIZAÇÃO +% ! ================================================ + +% |bcode !------------------------------------------------ +\fontsizedef{12pt}{ + \sizeselectordef\normalsize{12pt}{14.5pt} + \sizeselectordef\small{10pt}{12pt} +} +\setfontsize{12pt} +\spacing{1.5} + +\papersizedef{A4}(210mm,297mm) +\paper{ + A4, + left=3cm, + top=3cm, + right=2cm, + bottom=2cm +} + +\frenchspacing +\parindent=0pt +\parskip=0pt + +\tociuppercase +\sectionuppercase + +\tocifont {\bfseries} +\tociifont {\itshape} +\tociiifont {\scshape} +\tocivfont {} +\tocvfont {} + +\sectionfont {\bfseries} +\subsectionfont {\itshape} +\subsubsectionfont {\scshape} +\paragraphfont {} +\subparagraphfont {} + +\sectionspaces {\baselineskip}{\baselineskip} +\subsectionspaces {\baselineskip}{\baselineskip} +\subsubsectionspaces {\baselineskip}{\baselineskip} +\paragraphspaces {\baselineskip}{\baselineskip} +\subparagraphspaces {\baselineskip}{\baselineskip} + +\legendplacedef{figure}{Figura}{fig.\,#1}{lof} +\legendplacedef{table}{Tabela}{tab.\,#1}{lot} + +\def\legendlabel{\legendname ~\thelegend ~---~} +\def\srclabel{\raggedright\small Fonte:~} +\def\legendmaxwidth{0.7\linewidth} + +\placespaces{\baselineskip}{\baselineskip} + +\def\makelof{\heading{Lista de figuras} + \def\extlabelwidth{12.5ex}% + \def\extlabelbox##1{\hbox to\extlabelwidth{Figura ##1 ---\hfil}}% + \extfile{lof}\newpage +} +\def\makelot{\heading{Lista de tabelas} + \def\extlabelwidth{12.5ex} + \def\extlabelbox##1{\hbox to\extlabelwidth{Tabela ##1 ---\hfil}}% + \extfile{lot}\newpage +} +\def\maketoc{\heading{Sumário} + \def\extlabelwidth{4ex} + \def\extlabelbox##1{\hbox to\extlabelwidth{##1\hfil}}% + \extfile{toc}\newpage +} + +\arrayrulewidth=0.4pt + +\topskip=12pt + +\pretextual + +\endinput +% |ecode !------------------------------------------------ diff --git a/macros/latex/contrib/jobname-suffix/README.md b/macros/latex/contrib/jobname-suffix/README.md new file mode 100644 index 0000000000..8e35de3524 --- /dev/null +++ b/macros/latex/contrib/jobname-suffix/README.md @@ -0,0 +1,25 @@ +# jobname-suffix +LaTeX package to achieve different outputs based on the filename + +### Compiling + +#### Running tests + +Run tests with + +```bash +l3build check +``` + +To override a test's output (for example if you changed the test), run + +```bash +l3build save jobname-suffix-001 +``` + +## Missing `l3build` + +If your system does not have `l3build` installed into the system path, +you may need to access it directly. For example, on my system it is located +at `/usr/share/texmf-dist/scripts/l3build/l3build.lua` and can be +directly invoked. diff --git a/macros/latex/contrib/jobname-suffix/jobname-suffix.pdf b/macros/latex/contrib/jobname-suffix/jobname-suffix.pdf new file mode 100644 index 0000000000..6693efda38 Binary files /dev/null and b/macros/latex/contrib/jobname-suffix/jobname-suffix.pdf differ diff --git a/macros/latex/contrib/jobname-suffix/jobname-suffix.sty b/macros/latex/contrib/jobname-suffix/jobname-suffix.sty new file mode 100644 index 0000000000..d57014ff96 --- /dev/null +++ b/macros/latex/contrib/jobname-suffix/jobname-suffix.sty @@ -0,0 +1,134 @@ +\NeedsTeXFormat{LaTeX2e}[1994/06/01] +\ProvidesExplPackage{jobname-suffix}{2022/09/17}{1.0}{Compile differently based on the filename} + +\RequirePackage{expl3} +\ExplSyntaxOn + +% +% Variants +% +\cs_generate_variant:Nn \str_set:Nn {Ne} +\cs_generate_variant:Nn \str_if_eq:nnTF {nfTF} + +% +% Messages +% +\msg_new:nnn {jobname-suffix} {initial-data} { + \\ + (jobname-suffix)\ \ \ Found~jobname~~`#1'~~with~suffix~~`#2' + \\ +} +\msg_new:nnn {jobname-suffix} {override} { + \\ + (jobname-suffix)\ \ \ Overriding~suffix~with~`#1' + \\ +} +\msg_new:nnn {jobname-suffix} {test} { + \\ + (jobname-suffix)\ \ \ Testing~`#1'~==~`#2' + \\ +} +\msg_new:nnn {jobname-suffix} {condition} { + \\ + (jobname-suffix)\ \ \ Condition~is~`#1' + \\ +} + + + + + +\str_new:N \g__suffix_str +\str_new:N \g__jobname_str +\str_new:N \g__split_char_str +\str_set:Nn \g__split_char_str {-} +\seq_new:N \l__suffix_list_seq +\str_new:N \l__suffix_list_str + + + + + +\int_new:N \l__slice_pos_int +% Slice #1 at the char indicated by #2 and store the result in #3 +\cs_new_protected:Nn \__slice_at_char:NNN { + \int_set:Nn \l__slice_pos_int {1} + \str_map_inline:Nn #1 { + \int_incr:N \l__slice_pos_int + \str_if_eq:VnTF {#2} {##1} { + \str_map_break: + }{} + } + \str_set:Nx #3 {\str_range:Nnn #1 {\l__slice_pos_int}{\c_max_int}} +} + + +% If the string starts with a quote, trim it off. +\cs_new:Nn \__trim_quotes:N { + \str_if_eq:nfTF {"} { \str_range:Nnn #1 {1}{1}} { + \str_range:Nnn #1 {2}{-1+\str_count:N #1} + }{ + #1 + } +} + +% The jobname will be surrounded by quotes if there are any spaces in it, +% so we first trim it if needed. +\str_set:Nx \g__jobname_str { \__trim_quotes:N \c_sys_jobname_str } +% Find the suffix string. The result will be stored in the last argument +\__slice_at_char:NNN \g__jobname_str \g__split_char_str \g__suffix_str + +\msg_term:nnxx {jobname-suffix} {initial-data} {\g__jobname_str} {\g__suffix_str} + +% +% User-facing commands and environments +% + +% Optional arg is a comma-separate list of suffixes. If any of the listed +% suffixes match the jobname's suffix, the true contiditon is executed. Otherwise +% the false condition is executed. +\NewDocumentCommand{\IfSuffixTF}{ o +m +m }{ + %\msg_term:nnxx {jobname-suffix} {test} {#1} {\g__suffix_str} + + \IfNoValueTF {#1} { + %\msg_term:nnx {jobname-suffix} {condition} {FALSE} + #3 + }{ + % We want to do string-based comparisons, so we must first + % cast our argument list as a string (otherwise, \seq_* operations + % won't work properly). + \str_set:Nn \l__suffix_list_str {#1} + \seq_set_split:NnV \l__suffix_list_seq {,} {\l__suffix_list_str} + + \seq_if_in:NVTF \l__suffix_list_seq {\g__suffix_str} { + %\msg_term:nnx {jobname-suffix} {condition} {TRUE} + #2 + } { + %\msg_term:nnx {jobname-suffix} {condition} {FALSE} + #3 + } + } +} + +\NewDocumentCommand{\IfSuffixT}{ o +m }{ + \IfSuffixTF[#1]{#2}{} +} + +\NewDocumentCommand{\IfSuffixF}{ o +m }{ + \IfSuffixTF[#1]{}{#2} +} + +\NewDocumentEnvironment{IfSuffix}{ o +b }{ + \IfSuffixT[#1]{#2} +}{} + +\NewDocumentCommand{\OverrideSuffix}{ m }{ + \str_set:Nn \g__suffix_str {#1} + \msg_term:nnx {jobname-suffix} {override} {\g__suffix_str} +} +\NewExpandableDocumentCommand{\JobnameSuffix}{}{ + \str_use:N \g__suffix_str +} + + +\ExplSyntaxOff diff --git a/macros/latex/contrib/jobname-suffix/jobname-suffix.tex b/macros/latex/contrib/jobname-suffix/jobname-suffix.tex new file mode 100644 index 0000000000..0ae054b602 --- /dev/null +++ b/macros/latex/contrib/jobname-suffix/jobname-suffix.tex @@ -0,0 +1,229 @@ +%% pig.dtx +%% Copyright 2022 Jason Siefken +% +% This work may be distributed and/or modified under the +% conditions of the LaTeX Project Public License, either version 1.3 +% of this license or (at your option) any later version. +% The latest version of this license is in +% http://www.latex-project.org/lppl.txt +% and version 1.3 or later is part of all distributions of LaTeX +% version 2005/12/01 or later. +% +% This work has the LPPL maintenance status `maintained'. +% +% The Current Maintainer of this work is Jason Siefken +% +% This work consists of the files jobname-suffix.sty and docs/jobname-suffix.tex +\documentclass{l3doc} +\usepackage{listings,xcolor} + +\lstdefinestyle{mystyle}{ + language=[LaTeX]{TeX}, + texcsstyle=*\color{blue}, + commentstyle={\color{green!50!black}\itshape}, + basicstyle=\ttfamily, + moretexcs={IfSuffixT,IfSuffixF,IfSuffixTF,OverrideSuffix,JobnameSuffix,solution}, % user command highlight + frame=single, +} +\lstset{style=mystyle} + +\title{% + \pkg{jobname-suffix}\\ + Compile different content based on the file name% +} + +\author{% + Jason Siefken% + \thanks{% + Please file an issues/comments to \url{https://github.com/siefkenj/jobname-suffix/issues} + } +} + +\date{Released \today} + +\NewDocumentCommand{\fileshow}{m}{% +\par +\noindent\begin{minipage}{\linewidth} + \noindent\texttt{\itshape #1:} + \vspace{-1cm} +\end{minipage} +} + +\begin{document} + \maketitle + + \tableofcontents + + \begin{abstract} + \pkg{jobname-suffix} allows one to compile a document differently depending + on the document's file name (internally called the \texttt{jobname} in \TeX). + This allows one to have one source file and multiple links to this source file (either + as symbolic links, or as different files referencing the original via an \cs{input} + command) that are each compile differently. For example, an exam might have an + \file{exam-student.tex} and an \file{exam-instructor.tex} which both reference the + same source code but where the instructor version includes solutions and the student + version does not. + \end{abstract} + + \begin{documentation} + + \section{Introduction} + \pkg{jobname-suffix} by default allows you to reference the part of a file name (technically the \cs{jobname}) + that comes after the first ``\texttt{-}'' character and use that information to control what \LaTeX{} produces. + + Consider the following example: you have three files \file{exam.tex}, \file{exam-student.tex}, and \file{exam-instructor.tex}. + The files \file{exam-student.tex} and \file{exam-instructor.tex} are either symbolic links to \file{exam.tex} (if your operating + system supports symbolic links) or use \cs{input}\Arg{exam.tex file path} to include the contents of \file{exam.tex}. + + \fileshow{exam-student.tex \textnormal{and} exam-instructor.tex} + \begin{lstlisting} +\input{exam.tex} + \end{lstlisting} + + \fileshow{exam.tex} + \begin{lstlisting} +\documentclass{article} +\usepackage{jobname-suffix} + +\newcommand{\solution}[1]{#1} +\IfSuffixT[instructor]{ + % Instructors get solutions emboldened + \renewcommand{\solution}[1]{\textbf{#1}} +} +\IfSuffixT[student]{ + % Students don't see solutions at all + \renewcommand{\solution}[1]{} +} + +\begin{document} + \begin{enumerate} + \item First question + \solution{First answer} + + \item Second question + \solution{Second answer} + \end{enumerate} +\end{document} + \end{lstlisting} + + \noindent Then, compiling via + + \noindent\texttt{> lualatex exam-instructor.tex} + + \noindent\texttt{> lualatex exam-student.tex} + + \noindent will produce two pdfs: one with solutions and one without. + + \section{Usage} + \subsection{Variables} + + \begin{variable}{\JobnameSuffix} + The computed suffix of the filename (\cs{jobname}). This is normally the part of the file name after the first ``\texttt{-}'' + character and before the file extension. For example, + \file{file-a.tex} has a \cs{JobnameSuffix} of ``\texttt{a}'', + \file{file-a-b.tex} has a \cs{JobnameSuffix} of ``\texttt{a-b}'', + and \file{file.tex} has a \cs{JobnameSuffix} of consisting of the empty string. + \end{variable} + + \subsection{Commands} + \begin{function}{\IfSuffixTF, \IfSuffixT, \IfSuffixF} + \begin{syntax} + \cs{IfSuffixTF}\oarg{suffixes}\marg{true condition}\marg{false condition} + \cs{IfSuffixT}\oarg{suffixes}\marg{true condition} + \cs{IfSuffixF}\oarg{suffixes}\marg{false condition} + \end{syntax} + The argument \meta{suffixes} is a comma-separated list of all suffixes you wish to test against. + \end{function} + + \begin{function}{\OverrideSuffix} + \begin{syntax} + \cs{OverrideSuffix}\marg{suffix} + \end{syntax} + Override \cs{JobnameSuffix} to be the suffix specified by \meta{suffix} instead. + \end{function} + + \subsection{Environments} + + \DescribeEnv{IfSuffix} + The \env{IfSuffix} environment accepts an optional argument \oarg{suffixes} and will display its contents (unmodified) + if \cs{JobnameSuffix} is among the comma-separated list \meta{suffixes}. Unfortunately this environment cannot contain + \env{verbatim} contents. + + \section{Compiling} + + \pkg{jobname-suffix} works by reading the \cs{jobname} macro that is part of standard \TeX. By default, this is + set to the file name without the file extension. You can affect the jobname in one of two ways: + \begin{enumerate} + \item The name of your file. + \item By supplying the \texttt{-jobname} option during compilation. For example, the following two + commands would both result in compiling with a \cs{jobname} of \texttt{exam-student}. + + \noindent\texttt{> lualatex -jobname exam-instructor exam.tex} + + \noindent\texttt{> lualatex exam-instructor.tex} + \end{enumerate} + + \section{Tips} + + \begin{itemize} + \item + For performance reasons, it is best to \cs{IfSuffixTF} to define/redefine commands in your document preamble + rather than to use them in your document body/macro bodies. For example, do + +\begin{lstlisting} +\documentclass{article} +\usepackage{jobname-suffix} + +\newcommand{\solution}[1]{#1} +\IfSuffixT[instructor]{ + % Instructors get solutions emboldened + \renewcommand{\solution}[1]{\textbf{#1}} +} + +\begin{document} + \solution{Some Text} +\end{document} +\end{lstlisting} + +instead of + +\begin{lstlisting} +\documentclass{article} +\usepackage{jobname-suffix} + +\newcommand{\solution}[1]{% + \IfSuffixTF[instructor]{% + % Instructors get solutions emboldened + \textbf{#1}% + }{% + #1% + } +} + +\begin{document} + \solution{Some Text} +\end{document} +\end{lstlisting} + + \item + To match the case when you have ``no suffix'' (i.e., when the suffix is the empty string because ``\texttt{-}'' did not appear in + the filename), use \cs{IfSuffix[]} with an empty argument list\footnote{ + If you omit the optional argument, \cs{IfSuffixT} will never be true (not even if \cs{JobnameSuffix} is the empty string). + }. + \end{itemize} + + + \section{Installation} + + For manual installation, the package is available from + \href{http://ctan.org/pkg/jobname-suffix}{{CTAN}}. + + The package requires \LaTeX3 support as provided in the \pkg{l3kernel} and + \pkg{l3packages} bundles. Both of these are included in \TeX{} Live and + MiK\TeX{}, or are again available in ready-to-install form from {CTAN}. + + \end{documentation} + + + \PrintIndex +\end{document} diff --git a/macros/latex/contrib/lettrine/README.md b/macros/latex/contrib/lettrine/README.md index 73d10c6773..f62a7c20c6 100644 --- a/macros/latex/contrib/lettrine/README.md +++ b/macros/latex/contrib/lettrine/README.md @@ -31,9 +31,9 @@ Installation This bundle is included in most TeX distributions, but if you need to install it by yourself -1. run lualatex on lettrine.dtx to get the documentation (lettrine.pdf), +1. run lualatex on lettrine.dtx to get the documentation (lettrine.pdf); 2. run luatex on lettrine.ins to strip the comments and create - lettrine.sty and lettrine.cfg + lettrine.sty and lettrine.cfg; 3. run luatex on contrib.dtx to produce the *.cfl files. Files lettrine.sty, lettrine.cfg, lettrine-*.sty and *.cfl go to to @@ -46,5 +46,5 @@ Files *.dtx, *.ins go to a source directory, typically $TEXMF/source/latex/lettrine -- -Copyright 1999--2020 Daniel Flipo +Copyright 1999--2022 Daniel Flipo E-mail: daniel (dot) flipo (at) free (dot) fr diff --git a/macros/latex/contrib/lettrine/doc/W.pdf b/macros/latex/contrib/lettrine/doc/W.pdf new file mode 100644 index 0000000000..5fd9502f08 Binary files /dev/null and b/macros/latex/contrib/lettrine/doc/W.pdf differ diff --git a/macros/latex/contrib/lettrine/doc/demo-de.pdf b/macros/latex/contrib/lettrine/doc/demo-de.pdf deleted file mode 100644 index 3c7102a898..0000000000 Binary files a/macros/latex/contrib/lettrine/doc/demo-de.pdf and /dev/null differ diff --git a/macros/latex/contrib/lettrine/doc/demo-de.tex b/macros/latex/contrib/lettrine/doc/demo-de.tex deleted file mode 100644 index 204841e854..0000000000 --- a/macros/latex/contrib/lettrine/doc/demo-de.tex +++ /dev/null @@ -1,245 +0,0 @@ - -\documentclass[a4paper,12pt,german]{article} -\usepackage{iftex} -\iftutex - \usepackage{fontspec} - \setmainfont{erewhon} % erewhon (Utopia) -\else - \usepackage{fourier} % fourier (Utopia) und - \renewcommand{\ttdefault}{lmtt} % Latin Modern Typewriter fonts -\fi - -\usepackage[a4paper,text={150mm,240mm},centering]{geometry} -\usepackage{microtype} - -\usepackage{lettrine} -\usepackage{graphicx,color} -\usepackage{lettrine} - -\usepackage{babel} - -\newcommand{\MF}{{\small\scshape metafont}} -\newcommand{\MP}{{\small\scshape metapost}} -\setlength{\parindent}{0pt} -\sloppy -\begin{document} -\thispagestyle{empty} - -\begin{center} -\large\bfseries Einige Beispiele zur Anwendung des lettrine-Pakets -\end{center} - -\vspace{\baselineskip} -\textit{Einfachste Verwendung (2 Zeilen) :}\\ -\verb+\lettrine{E}{in} erstes Beispiel...+ - -\lettrine{E}{in} erstes Beispiel zeigt das Standardverhalten von lettrine. -Es wird eine Initiale über zwei Zeilen produziert, gefolgt vom Text zwischen -den geschweiften Klammern, der als Kapitälchen gesetzt wird. Der weitere -Text umfliesst die Initiale. - -\vspace{\baselineskip} -\textit{Lettrine auf einer Zeile (option {\ttfamily\upshape lines=1}) :}\\ -\verb+\lettrine[lines=1]{E}{in} zweites Beispiel...+ - -\lettrine[lines=1]{E}{in} zweites Beispiel zeigt, wie eine Initiale auf -einer einzelnen Zeile aussieht. Auch hier ist der geklammerte Text in -Kapitälchen gesetzt. - -\vspace{\baselineskip} -\textit{Initiale über drei Zeilen (option {\ttfamily\upshape lines=3}) :}\\ -\verb+\lettrine[lines=3]{E}{in} drittes Beispiel...+ - -\lettrine[lines=3]{E}{in} drittes Beispiel in dem die Initiale über drei -Zeilen gesetzt wird. Beachten Sie die Einrückung der zweiten und dritten -Zeile. Diese kann mit dem Parameter \verb+nindent= + beeinflusst werden. Die -Einrückung der ersten Zeile wird hingegen mit dem Parameter \verb+findent= + -beeinflusst. - -\vspace{\baselineskip} -\textit{Initiale vollständig im Randbereich} :\\ -\verb+\lettrine[lhang=1,findent= .3em,nindent=0pt,lines=3]{V}{erschieben}+ - -\lettrine[lhang=1,findent= .3em,nindent=0pt,lines=3]{V}{erschieben} -wir nun im vierten Beispiel die Initiale in den Randbereich. -Dieses Verhalten wird durch den Parameter \verb+lhang= + gesteuert. - -\vspace{\baselineskip} -\textit{Initiale, vergrössert und teilweise im Randbereich} :\\ -\verb+\lettrine[lines=3, lhang=0.33, loversize=0.25]{A}{uch}+ - -\lettrine[lines=3, lhang=0.33, loversize=0.25]{A}{uch} -die Vergrösserung der Initiale ist möglich. Die Vergrösserung läuft -über die Variable \verb+loversize= + . Sie müssen das Ergebnis nicht -unbedingt schön finden. Es sieht nach meiner Meinung besser aus, wie das -vollständige Verschieben in den Randbereich. - -\vspace{\baselineskip} -\textit{Setzen wir nun eine %französisches - Anführungszeichen davor} :\\ -\verb+\lettrine[ante=\frqq]{M}{it} dem Parameter ...+ - -\lettrine[ante=\frqq]{M}{it} dem Parameter \verb+ante= + kann auch ein -beliebiger Text vor die Initiale gesetzt werden. In der Praxis dürften -wohl nur Anführungszeichen dafür in Frage kommen. - -\vspace{\baselineskip} -\verb+\def\lglqq{\raisebox{-\baselineskip}{\glqq}}+\\ -\verb+\lettrine[ante=\lglqq]{M}{it} dem Parameter ...+ -\def\lglqq{\raisebox{-\baselineskip}{\glqq}} - -\lettrine[ante=\lglqq]{M}{it} dem Parameter \verb+ante= + kann auch ein -beliebiger Text vor die Initiale gesetzt werden. In der Praxis dürften -wohl nur Anführungszeichen dafür in Frage kommen. - -\newpage -\textit{Wir verkleinern die Initiale nun um 10\% und heben sie -um 15\% wegen des {\glqq}Q{\grqq}}:\\ -\verb+\lettrine[lines=4, loversize=-.15, lraise=.15]{Q}{ualität}+ - -\lettrine[lines=4, loversize=-.15, lraise=.15]{Q}{ualität} hat ihren -Preis. Und wenn es nur die Zeit ist, um zu lernen wie Sie solche Spielereien -anstellen können. Bei den Ergebnissen lohnt sich aber die Mühe. Welche -Parameter diesmal was beeinflussen, lasse ich Sie nun selbst herausfinden. -Wie Sie sehen, ragt der Unterstrich des {\glqq}Q{\grqq} nicht in den Text -hinein. - -\vspace{.5\baselineskip} -\textit{Andere Möglichkeit: Nochmal das {\glqq}Q{\grqq} in normaler - Größe aber mit einer Zeile mehr darunter} -\verb+\lettrine[lines=4,depth=1]{Q}{ualität}+ - -\lettrine[lines=4,depth=1]{Q}{ualität} hat ihren Preis. Und wenn es nur die -Zeit ist, um zu lernen wie Sie solche Spielereien anstellen können. Bei den -Ergebnissen lohnt sich aber die Mühe. Welche Parameter diesmal was -beeinflussen, lasse ich Sie nun selbst herausfinden. Wie Sie sehen, ragt der -Unterstrich des {\glqq}Q{\grqq} auch nicht in den Text hinein: eine Zeile mehr -wurde darunter mit \verb+depth=1+ frei gemacht. - -\vspace{.5\baselineskip} -\textit{Verwendung der Option {\ttfamily\upshape slope}}, damit der Text -der Neigung des {\glqq}A{\grqq} folgt:\\ -\verb+\lettrine[lines=4, slope=0.6em, findent=-1em,+\\ -\verb+ nindent=0.6em]{\A}{uch}...+ - -\lettrine[lines=4, slope=0.6em, findent=-1em, nindent=0.6em]{A}{uch} eine -Neigung kann angegeben werden. Damit werden die Löcher neben geneigten -Buchstaben nicht so gross. Selbst eine negative Neigung ist möglich, damit -bietet auch das {\glqq}V{\grqq} keine Schwierigkeiten mehr. Wie das beim -{\glqq}V{\grqq} aussieht, sehen wir uns beim nächsten Beispiel an. - -\vspace{.5\baselineskip} -\textit{Verwendung der Option {\ttfamily\upshape slope}, damit der Text -der Neigung des {\ttfamily\upshape V} folgt; Das {\ttfamily\upshape V} ragt -zusätzlich halb in den Rand hinein -(Option {\ttfamily\upshape lhang=0.5} :})\\ -\verb+\lettrine[lines=4, slope=-0.5em, lhang=0.5, findent=.5em,nindent=0pt]+\\ -\verb+ {V}{iel} ist...+ - -\lettrine[lines=4, slope=-0.5em, lhang=0.5, findent=.5em, nindent=0pt]{V}{iel} -ist hier nicht anders. Nur die negative Neigung und das Hereinragen in den -Rand. Ob Ihnen das Ergebnis gefällt müssen Sie selber entscheiden. -Sie sehen aber, das das {\glqq}V{\grqq} wirklich keine Schwierigkeiten bietet. -Der Unterschied zum vorhergehenden Beispiel ist nicht besonders gross. - -\vspace{.5\baselineskip} -\textit{Ändern wir nun die Schriftfamilie für die Initiale -(hier AvantGarde bold italique):}\\ -\verb+\renewcommand{\LettrineFontHook}{\fontfamily{pag}\fontencoding{T1}%+\\ -\verb+ \fontseries{bx}\fontshape{it}}+\\ -\verb+\lettrine[findent=.3em]{A}{uch} ein Wechsel...+ - -{% (Ändern des lokalen fonts) -\renewcommand{\LettrineFontHook}{\fontfamily{pag}\fontencoding{T1}\fontseries{bx}\fontshape{it}} - -\lettrine[findent=.3em]{A}{uch} ein Wechsel der Schriftfamilie ist problemlos -möglich. Hier verwenden wir Avantgarde und setzen mit der Option -\verb+findent= + den horizontalen Abstand des eingerückten Texts. -\par} - -\vspace{.5\baselineskip} -\textit{Ändern wir nun die Schriftfamilie und die Farbe für die Initiale -(hier yfrak in Grau) :}\\ -\verb+\renewcommand{\LettrineFontHook}{\fontfamily{yfrak}\fontencoding{T1}+\\ -\verb+ \color[gray]{0.5}}\lettrine[loversize=0.1]{A}{uch}...+ - -{% (Aendern des lokalen fonts) -\renewcommand{\LettrineFontHook}{\fontfamily{yfrak}\fontencoding{T1} - \color[gray]{0.5}} - -\lettrine[loversize=0.1]{A}{uch} ein Wechsel der -Schriftfamilie ist problemlos möglich. Hier verwenden wir yfrak, -etwas vergrössert mit der Option \verb+loversize= +, und wir schreiben -die Initiale in Grau mit \verb+\color[gray]{0.5}+. -\par} - -\newpage -\begin{center} -\large\bfseries Verwendung eines PostScript-Bildes als Initiale -\end{center} - -\vspace{\baselineskip} Wenn die erwünschte Initiale nicht als Zeichen eines -Fonts, sondern als Bild im Postscript-Format vorliegt, kann ebenfalls -\verb+\lettrine+ verwendet werden. Es genügt, -die Boolsche Variable \texttt{image=true} zu benützen; z.B. so: - -\vspace{.5\baselineskip} -{% Gruppierung, um die LOKALEN Definitionen zu schützen -\fontfamily{yfrak}\fontencoding{T1}\selectfont\Large -\renewcommand{\LettrineTextFont}{\relax} -\lettrine[image=true, lines=3, lhang=.2, loversize=.25, % - lraise=-.05, findent=0.1em, nindent=0em] -{W}{er} reitet so spät durch Nacht und Wind?\\ -Es ist der Vater mit seinem Kind;\\ -Er hat den Knaben wohl in dem Arm,\\ -Er fa{\ss}t ihn sicher, er hält ihn warm. -\par} - -\vspace{\baselineskip} Und hier der zum Beispiel gehörende \LaTeX{}--Code: -Das erste Argument von \verb+\lettrine+ war \verb+W+. Die Option \texttt{image=true} -lädt dann die Datei \verb+W.eps+. Das Suffix \verb+.eps+ kann -- dank des -Pakets \verb+graphicx.sty+ -- weggelassen werden. - -\begin{verbatim} -{\fontfamily{yfrak}\fontencoding{T1}\selectfont\Large -\renewcommand{\LettrineTextFont}{\relax} -\lettrine[image=true, lines=3, lhang=.2, loversize=.25, % - lraise=-.05, findent=0.1em, nindent=0em] -{W}{er} reitet so spät durch Nacht und Wind? -Es ist der Vater mit seinem Kind; -Er hat den Knaben wohl in dem Arm, -Er fa{\ss}t ihn sicher, er hält ihn warm.\par} -\end{verbatim} - -Zur Darstellung dieses Beispiels müssen folgende Pakete installiert sein: -\begin{itemize} -\item \verb+graphicx.sty+, -\item die Schriften \verb+yfrak.pfb+ im type\,1-Format - von Yannis~\textsc{Haralambous}, -\item das Paket \verb+blacklettert1+ von Thorsten~\textsc{Bronger}. -\end{itemize} - -Die gothische Initiale \glqq W\grqq{} in diesem Beispiel können Sie mit dem -Programm \MP{} aus den \MF{}-Sourcen und \verb+yinitW.mf+ erzeugen. - -Falls Sie eine PDF-Datei erzeugen wollen, müssen Sie die Datei \verb+W.eps+ -in eine PDF-Datei \verb+W.pdf+ umwandeln (mit Hilfe von \verb+epstopdf+). - -\verb+\lettrine+ unterstützt die Verwendung der Formate: -\texttt{pdf}, \texttt{png}, \texttt{jpeg} oder \MP{} als Initiale. - -\vfill -\begin{flushright} - Deutsche Version Georg \textsc{Wagner}\\ - \texttt{g.wagner@datacomm.ch}\\ - Mai 2003, ergänzt September 2014 -\end{flushright} - -\end{document} - -%%% Local Variables: -%%% mode: latex -%%% coding: utf-8 -%%% TeX-master: t -%%% TeX-engine: xetex -%%% End: diff --git a/macros/latex/contrib/lettrine/doc/demo-fr.pdf b/macros/latex/contrib/lettrine/doc/demo-fr.pdf deleted file mode 100644 index dc30880860..0000000000 Binary files a/macros/latex/contrib/lettrine/doc/demo-fr.pdf and /dev/null differ diff --git a/macros/latex/contrib/lettrine/doc/demo-fr.tex b/macros/latex/contrib/lettrine/doc/demo-fr.tex deleted file mode 100644 index 21e525ed06..0000000000 --- a/macros/latex/contrib/lettrine/doc/demo-fr.tex +++ /dev/null @@ -1,302 +0,0 @@ - -\documentclass[paper=a4,12pt,german,french]{scrartcl} -\usepackage{iftex} -\iftutex - \usepackage{fontspec} - \setmainfont{erewhon} -\else - \usepackage[utf8]{inputenc} - \usepackage{fourier} - \renewcommand{\ttdefault}{lmtt} % Courier chasse trop ! -\fi -\usepackage{microtype} -\usepackage{Rothdn, Typocaps} % cfr-initials (p. 3) - -\usepackage{graphicx,color} -\usepackage{lettrine} -\usepackage{babel} -\frenchbsetup{AutoSpacePunctuation=false,og=«,fg=»} - -\newcommand*{\MF}{{\small\scshape metafont}} -\newcommand*{\MP}{{\small\scshape metapost}} -\newcommand*{\file}[1]{\texttt{#1}} -\newcommand*{\cs}[1]{\texttt{\boi#1}} - -\setlength{\parindent}{0pt} -\sloppy -\begin{document} -\thispagestyle{empty} - -\begin{center} -\large\bfseries Quelques exemples de lettrines -\end{center} - -\vspace{\baselineskip} -\textit{Usage standard (2 lignes) :}\\ -\verb+\lettrine{E}{n} plein marais...+ - -\lettrine{E}{n} plein marais de la Souteyranne, à quelques kilomètres -au nord d'Aigues-Mortes, se trouve la Tour Carbonnière. -Construite au XIII\ieme~siècle, elle contrôlait l'unique voie d'accès -terrestre de la ville fortifiée, celle qui menait à Psalmody. - -\vspace{\baselineskip} -\textit{Lettrine sur une seule ligne (option {\ttfamily\upshape lines=1}) :}\\ -\verb+\lettrine[lines=1]{E}{n} plein marais...+ - -\lettrine[lines=1]{E}{n} plein marais de la Souteyranne, -à quelques kilomètres au nord d'Aigues-Mortes, se trouve -la Tour Carbonnière. - -\vspace{\baselineskip} -\textit{Lettrine sur trois lignes (option {\ttfamily\upshape lines=3}) :}\\ -\verb+\lettrine[lines=3]{E}{n} plein marais...+ - -\lettrine[lines=3]{E}{n} plein marais de la Souteyranne, -à juste quelques kilomètres au nord d'Aigues-Mortes, -se trouve la Tour Carbonnière. -Elle contrôlait l'unique voie d'accès -terrestre de la ville fortifiée, celle qui menait à Psalmody, -l'une des « abbayes de sel» dont il ne reste que quelques vestiges. - -\vspace{\baselineskip} -\textit{Lettrine complètement dans la marge} :\\ -\verb+\lettrine[lhang=1, nindent=0pt, lines=3]{J}{ustement},...+ - -\lettrine[lhang=1, nindent=0pt, lines=3]{J}{ustement}, -à quelques kilomètres au nord d'Aigues-Mortes, -se trouve la Tour Carbonnière. -Construite au XIII\ieme~siècle, elle contrôlait l'unique voie d'accès -terrestre de la ville fortifiée, celle qui menait à Psalmody, -l'une des « abbayes de sel» dont il ne reste que quelques vestiges. -L'abbaye était ravitaillée ---~dit-on ~--- par un souterrain -qui la reliait au château de Treillan. - -\vspace{\baselineskip} -\textit{Lettrine en saillie à la fois en hauteur et dans la marge} :\\ -\verb+\lettrine[lines=3, lhang=0.33, loversize=0.25]{E}{n} ...+ - -\lettrine[lines=3, lhang=0.33, loversize=0.25]{E}{n} -plein marais de la Souteyranne, -à quelques kilomètres au nord d'Aigues-Mortes la Tour Carbonnière. -Construite au XIII\ieme~siècle, elle contrôlait l'unique voie d'accès -terrestre de la ville fortifiée, celle qui menait à Psalmody, -l'une des « abbayes de sel» dont il ne reste que des vestiges. - -\vspace{\baselineskip} -\textit{On peut ajouter un guillemet devant la lettrine} :\\ -\verb+\lettrine[ante=«]{E}{n} plein marais ...+ - -\lettrine[ante=«]{E}{n} plein marais de la Souteyranne, -à quelques kilomètres au nord d'Aigues-Mortes, se trouve -la Tour Carbonnière. -Construite au XIII\ieme~siècle, elle contrôlait l'unique voie d'accès -terrestre de la ville fortifiée, celle qui menait à Psalmody. - -\newpage -Toutes Les lettrines suivantes seront en gris jusqu'à nouvel ordre : \\ -\verb+\renewcommand{\LettrineFontHook}{\color[gray]{0.5}}+ -\renewcommand{\LettrineFontHook}{\color[gray]{0.5}} - -\vspace{.5\baselineskip} -\textit{On diminue la taille de la lettrine de 10\% et on -la remonte de 10\% à cause du « Q »} -\verb+\lettrine[lines=4, loversize=-0.1, lraise=0.1]{Q}{u'en...+ - -\lettrine[lines=4, loversize=-0.1, lraise=0.1]{Q}{u'en plein marais} - de la Souteyranne, à quelques kilomètres au nord d'Aigues-Mortes, -se trouve la Tour Carbonnière, surprend les visiteurs. -Construite au XIII\ieme~siècle, elle contrôlait l'unique voie d'accès -terrestre de la ville fortifiée, celle qui menait à Psalmody, -l'une des « abbayes de sel» dont il ne reste que quelques vestiges. -L'abbaye était ravitaillée par un souterrain qui -la reliait au château de Treillan. - -\vspace{.5\baselineskip} -\textit{Autre solution : ajout d’une ligne grâce à} \verb+depth+\\ -\verb+\lettrine[lines=4,depth=1]{Q}{u'en plein marais} de ...+ - -\lettrine[lines=4,depth=1]{Q}{u'en plein marais} de la Souteyranne, -à quelques kilomètres au nord d'Aigues-Mortes, -se trouve la Tour Carbonnière, surprend les visiteurs. -Construite au XIII\ieme~siècle, elle contrôlait l'unique voie d'accès -terrestre de la ville fortifiée, celle qui menait à Psalmody, -l'une des « abbayes de sel» dont il ne reste que quelques vestiges. -L'abbaye était ravitaillée ---~dit-on~--- par un souterrain qui -la reliait au château de Treillan. - -\vspace{.5\baselineskip} -\textit{Utilisation de l'option {\ttfamily\upshape slope}} pour que le texte -suive la pente du « À » :\\ -\verb+\lettrine[lines=4, slope=0.6em, findent=-1em,+\\ -\verb+ nindent=0.6em]{À}{quelques kilomètres}...+ - -\lettrine[lines=4, slope=0.6em, findent=-1em, nindent=0.6em]{À} {quelques -kilomètres} au nord d'Aigues-Mortes, se trouve la Tour Carbonnière. -Construite au XIII\ieme~siècle, elle contrôlait l'unique voie d'accès -terrestre de la ville fortifiée, celle qui menait à Psalmody, -l'une des « abbayes de sel» dont il ne reste que quelques vestiges. -L'abbaye était ravitaillée ---~dit-on~--- par un souterrain qui -la reliait au château de Treillan. - -\vspace{.5\baselineskip} -\textit{Utilisation de l'option {\ttfamily\upshape slope} pour que le texte - suive la pente du {\ttfamily\upshape V}, noter que celui-ci est à - demi-poussé dans la marge par l'option {\ttfamily\upshape lhang=0.5} :}\\ -\verb+\lettrine[lines=4, slope=-0.5em, lhang=0.5, findent=.5em, nindent=0pt]+\\ -\verb+ {V}{oici} à...+ - -\lettrine[lines=4, slope=-0.5em, lhang=0.5, findent=.5em, nindent=0pt]{V}{oici} -à quelques kilomètres au nord d'Aigues-Mortes la Tour Carbonnière. -Construite au XIII\ieme~siècle, elle contrôlait l'unique voie d'accès -terrestre de la ville fortifiée, celle qui menait à Psalmody, -l'une des « abbayes de sel» dont il ne reste que quelques vestiges. -L'abbaye était ravitaillée ---~dit-on~--- par un souterrain qui -la reliait au château de Treillan distant de quelques kilomètres à peine. - -\newpage - -\begin{center} -\large\bfseries Deux exemples d’utilisation de cfr-initials -\end{center} - -\textit{Dans le préambule :} -\verb+\usepackage{Typocaps, Rothdn}+ - -\vspace{.5\baselineskip} -\textit{Changement de police (ici Typocaps) - et de couleur pour la lettrine :}\\ -\verb+\renewcommand{\LettrineFontHook}{\Typocapsfamily\color{red}}+\\ -\verb+\lettrine[findent=.3em]{E}{n} plein marais...+ - -{% Groupe (changement local de fonte) -\renewcommand{\LettrineFontHook}{\Typocapsfamily\color{red}} - -\lettrine[findent=.3em]{E}{n} plein marais de la Souteyranne, à quelques -kilomètres au nord d'Aigues-Mortes, se trouve la Tour Carbonnière. -Construite au XIII\ieme~siècle, elle contrôlait l'unique voie d'accès -terrestre de la ville fortifiée. -\par}% Fin du groupe. - -\vspace{.5\baselineskip} -\textit{Les quatre exemples suivants font appel à la police d’initiales Rothdn}\\ -\verb+\renewcommand{\LettrineFontHook}{\Rothdnfamily}+ - -\renewcommand{\LettrineFontHook}{\Rothdnfamily} - -\vspace{.5\baselineskip} - -\textit{Le calcul de la taille de la lettrine prend normalement comme - référence les lettres EFTZ (voir {\upshape\cs{LettrineTestString}}), - dans le cas de la police Rothdn ça donne ceci pour A : } - -\verb+\lettrine[lines=3]{A}{u} bord du marais+ - -\lettrine[lines=3]{A}{u} bord du marais de la Souteyranne, à quelques -kilomètres au nord d'Aigues-Mortes, se trouve la Tour Carbonnière. -Construite au XIII\ieme~siècle, elle contrôlait l'unique voie d'accès -terrestre de la ville fortifiée, celle qui menait à Psalmody, -l'une des « abbayes de sel» dont il ne reste que quelques vestiges. - -\vspace{\baselineskip} -\textit{L’option {\ttfamily\upshape refstring} donne une taille correcte à la - lettrine (le calcul est fait sur la base du A lui-même et non de EFTZ% - \footnote{Le F de la police Rothdn a une hauteur supérieure à celles des - autres lettres.} : -} - -\verb+\lettrine[refstring, lines=3]{A}{u} bord du marais+ - -\lettrine[refstring, lines=3]{A}{u} bord du marais de la Souteyranne, -à quelques kilomètres au nord d'Aigues-Mortes, se trouve la Tour Carbonnière. -Construite au XIII\ieme~siècle, elle contrôlait l'unique voie d'accès -terrestre de la ville fortifiée, celle qui menait à Psalmody, -l'une des « abbayes de sel» dont il ne reste que quelques vestiges. - - -\vspace{\baselineskip} -\textit{Il suffit maintenant de remonter la lettrine - ({\ttfamily\upshape lraise=0.15}) pour compenser sa profondeur : -} - -\verb+\lettrine[refstring, lraise=0.15, lines=3]{A}{u} bord du marais+ - -\lettrine[refstring, lraise=0.15, lines=3]{A}{u} bord du marais de la -Souteyranne, à quelques kilomètres au nord d'Aigues-Mortes, se trouve -la Tour Carbonnière. -Construite au XIII\ieme~siècle, elle contrôlait l'unique voie d'accès -terrestre de la ville fortifiée, celle qui menait à Psalmody, -l'une des « abbayes de sel» dont il ne reste que quelques vestiges. - -\newpage -\begin{center} -\large\bfseries Utilisation d'une image comme lettrine -\end{center} - -\vspace{\baselineskip} -Si la lettrine souhaitée n'est pas un caractère d'une fonte mais une -image, \verb+\lettrine+ peut encore être utilisée, il suffit -d'utiliser le booléen \texttt{image}, exemple : - -\begin{otherlanguage}{german} -\renewcommand{\LettrineTextFont}{\relax} -\fontfamily{yfrak}\fontencoding{T1}\selectfont\Large -\lettrine[image=true,lhang=.2, loversize=.25, findent=0.1em] -{W}{er} reitet so spät durch Nacht und Wind?\\ -Es ist der Vater mit seinem Kind;\\ -Er hat den Knaben wohl in dem Arm,\\ -Er fa{\ss}t ihn sicher, er hält ihn warm.\par -\end{otherlanguage} - -\vspace{.5\baselineskip} -Et voici le code \LaTeX{} correspondant ; -le premier argument de \verb+\lettrine+ étant \verb+W+, -\verb+\lettrine+ fait appel au fichier \verb+W.pdf+, \verb+W.jpg+, etc. en -pdfLaTeX (omission possible du suffixe \verb+.eps+, \verb+.pdf+, propriété -de \verb+graphicx.sty+). - -\begin{verbatim} -\begin{otherlanguage}{german} - \fontfamily{yfrak}\fontencoding{T1}\selectfont\Large - \renewcommand{\LettrineTextFont}{\relax} - \lettrine[image=true,lhang=.2, loversize=.25, findent=0.1em] - {W}{er} reitet so spät durch Nacht und Wind?\\ - Es ist der Vater mit seinem Kind;\\ - Er hat den Knaben wohl in dem Arm,\\ - Er fa{\ss}t ihn sicher, er hält ihn warm.\par -\end{otherlanguage} -\end{verbatim} - -Pour la compilation en pdfLaTeX cet exemple fait appel aux fichiers suivants : -\begin{itemize} -\item \texttt{graphicx.sty} (extension standard \LaTeXe{}), -\item \texttt{blackletter1} de Thorsten~\textsc{Bronger} (disponible sur CTAN), -\item les fontes gothiques « Fraktur » de Yannis~\textsc{Haralambous} type\,1 - \texttt{yfrak.pfb} disponibles sur CTAN). -\end{itemize} -L'initiale gothique « W » utilisée dans -cet exemple a été créée par \MP{} (fichier \texttt{W.pdf} ci-joint) -à partir du source \MF{} \texttt{yinitW.mf} de Yannis grâce aux précieuses -indications de Denis~\textsc{Roegel} que je remercie bien vivement. - -\vspace{.5\baselineskip} -Une solution plus simple s’offre aux utilisateurs de LuaLaTeX ou XeLaTeX pour -reproduire le poème ci-dessus : il suffit d’utiliser la police OpenType Yinit -pour la lettrine et par exemple une des polices OpenType UnifrakturMaguntia -pour le texte, voir le fichier \file{demo-lua.pdf}. - -\vfill -\begin{flushright} - Daniel \textsc{Flipo}\\ - \texttt{daniel.flipo@free.fr}\\ - mars 2020. -\end{flushright} - -\end{document} - -%%% Local Variables: -%%% mode: latex -%%% coding: utf-8 -%%% TeX-master: t -%%% TeX-engine: xetex -%%% End: diff --git a/macros/latex/contrib/lettrine/doc/demo-lua.pdf b/macros/latex/contrib/lettrine/doc/demo-lua.pdf deleted file mode 100644 index f0e6257e6e..0000000000 Binary files a/macros/latex/contrib/lettrine/doc/demo-lua.pdf and /dev/null differ diff --git a/macros/latex/contrib/lettrine/doc/demo-lua.tex b/macros/latex/contrib/lettrine/doc/demo-lua.tex deleted file mode 100644 index 4492ade68e..0000000000 --- a/macros/latex/contrib/lettrine/doc/demo-lua.tex +++ /dev/null @@ -1,116 +0,0 @@ -\documentclass[12pt,paper=a4,german,french,british]{scrartcl} - -\usepackage{lettrine} -\usepackage[dvipsnames]{xcolor} -\usepackage[colorlinks, urlcolor=ForestGreen, linkcolor=blue]{hyperref} - -%%% Linux Libertine fonts... -\usepackage{fontspec} -\setmainfont{Linux Libertine O} -%\setsansfont{TeX Gyre Heros}[Scale=MatchLowercase] -\setmonofont{Latin Modern Mono}[Scale=MatchLowercase] - -\usepackage{Typocaps} - -\usepackage{babel} -\frenchbsetup{AutoSpacePunctuation=false, og=«,fg=»} -\babeltags{fr=french, de=german, uk=british} - -\newcommand*{\file}[1]{\texttt{#1}} -\newcommand*{\cs}[1]{\texttt{\boi#1}} -\newcommand*{\MF}{{\small\scshape metafont}} - -\setlength{\parindent}{0pt} -\sloppy - -\begin{document} -\thispagestyle{empty} -\enlargethispage{2\baselineskip} - -\begin{center} -\large\bfseries Some LuaLaTeX examples -\end{center} - -Both files \file{demo-fr.tex} and \file{demo-de.tex} can be compiled either with -pdfLaTeX or with LuaLaTeX or XeLaTeX. The purpose of the next examples is to -show how easy it is to change the font for the dropped initial with Unicode -engines: no need to care about the low-level NFSS syntax, a simple -\cs{fontspec} call will do the trick. - -\vspace{.5\baselineskip} -In the first example, \textit{ Linux Libertine Initials} is used for the -dropped capital:\\ -\verb+\renewcommand{\LettrineFontHook}{\fontspec{LinLibertine_I.otf}}+\\ -\verb+\lettrine[lines=3]{E}{n plein marais de la Souteyranne...}+ - -\begin{fr} - \renewcommand{\LettrineFontHook}{\fontspec{LinLibertine_I.otf}} - \lettrine[lines=3]{E}{n plein marais de la Souteyranne}, à quelques - kilomètres au nord d'Aigues-Mortes, se trouve la Tour Carbonnière. - Construite au XIII\ieme~siècle, elle contrôlait l'unique voie d'accès - terrestre de la ville fortifiée, celle qui menait à Psalmody, - l'une des « abbayes de sel» dont il ne reste que quelques vestiges.\par -\end{fr} - -\vspace{.5\baselineskip} -Of course, it is still possible to use Type\,1 fonts for the dropped capitals, -here \textit{Typocaps} (red):\\ -\verb+\renewcommand{\LettrineFontHook}{\Typocapsfamily\color{red}}+\\ -\verb+\lettrine[findent=.3em]{E}{n plein marais de la Souteyranne}...+ - -\begin{fr} -\renewcommand{\LettrineFontHook}{\Typocapsfamily\color{red}} -\lettrine[findent=.3em]{E}{n plein marais de la Souteyranne}, à quelques -kilomètres au nord d'Aigues-Mortes, se trouve la Tour Carbonnière. -Construite au XIII\ieme~siècle, elle contrôlait l'unique voie d'accès -terrestre de la ville fortifiée.\par -\end{fr} - -\vspace{.5\baselineskip} -OpenType and TrueType free fonts are available for Old German, here is an example -featuring the \textit{Yinit} OpenType font% -\footnote{produced by Élie Roux from Yannis Haralambous’ Gothic Initials - originally in \MF.} -for the initial and \textit{UnifrakturMaguntia} TrueType font% -\footnote{\url{http://unifraktur.sourceforge.net/maguntia.html}} -for the running text. The later has several nice \textit{optional features}, -(here long s and old umlaut variant): - -\verb+\setmainfont{UnifrakturMaguntia.ttf}[StylisticSet=11,CharacterVariant=15]+\\ -\verb+\renewcommand{\LettrineTextFont}{\relax} % No small caps here!+ \\ -\verb+\renewcommand{\LettrineFontHook}{\fontspec{Yinit.otf}}+\\ -\verb+\lettrine[lhang=.2, loversize=.25, findent=0.1em]{W}{er} reitet+ - -\begin{de}\Large -\setmainfont{UnifrakturMaguntia.ttf}[StylisticSet=11,CharacterVariant=15] -\renewcommand{\LettrineTextFont}{\relax} -\renewcommand{\LettrineFontHook}{\fontspec{Yinit.otf}} -\lettrine[lhang=.2, loversize=.25, findent=0.1em] -{W}{er} reitet so spät durch Nacht und Wind?\\ -Es ist der Vater mit seinem Kind;\\ -Er hat den Knaben wohl in dem Arm,\\ -Er faßt ihn sicher, er hält ihn warm.\par -\end{de} - -\vspace{.5\baselineskip} -Without the \textit{optional features}, the output looks more modern: - -\begin{otherlanguage}{german}\Large -\setmainfont{UnifrakturMaguntia.ttf} -\renewcommand{\LettrineTextFont}{\relax} -\renewcommand{\LettrineFontHook}{\fontspec{Yinit.otf}} -\lettrine[lhang=.2, loversize=.25, findent=0.1em] -{W}{er} reitet so spät durch Nacht und Wind?\\ -Es ist der Vater mit seinem Kind;\\ -Er hat den Knaben wohl in dem Arm,\\ -Er faßt ihn sicher, er hält ihn warm.\par -\end{otherlanguage} - -\end{document} - -%%% Local Variables: -%%% mode: latex -%%% coding: utf-8 -%%% TeX-master: t -%%% TeX-engine: luatex -%%% End: diff --git a/macros/latex/contrib/lettrine/doc/lettrine-demo-de.pdf b/macros/latex/contrib/lettrine/doc/lettrine-demo-de.pdf new file mode 100644 index 0000000000..f27982ed41 Binary files /dev/null and b/macros/latex/contrib/lettrine/doc/lettrine-demo-de.pdf differ diff --git a/macros/latex/contrib/lettrine/doc/lettrine-demo-de.tex b/macros/latex/contrib/lettrine/doc/lettrine-demo-de.tex new file mode 100644 index 0000000000..204841e854 --- /dev/null +++ b/macros/latex/contrib/lettrine/doc/lettrine-demo-de.tex @@ -0,0 +1,245 @@ + +\documentclass[a4paper,12pt,german]{article} +\usepackage{iftex} +\iftutex + \usepackage{fontspec} + \setmainfont{erewhon} % erewhon (Utopia) +\else + \usepackage{fourier} % fourier (Utopia) und + \renewcommand{\ttdefault}{lmtt} % Latin Modern Typewriter fonts +\fi + +\usepackage[a4paper,text={150mm,240mm},centering]{geometry} +\usepackage{microtype} + +\usepackage{lettrine} +\usepackage{graphicx,color} +\usepackage{lettrine} + +\usepackage{babel} + +\newcommand{\MF}{{\small\scshape metafont}} +\newcommand{\MP}{{\small\scshape metapost}} +\setlength{\parindent}{0pt} +\sloppy +\begin{document} +\thispagestyle{empty} + +\begin{center} +\large\bfseries Einige Beispiele zur Anwendung des lettrine-Pakets +\end{center} + +\vspace{\baselineskip} +\textit{Einfachste Verwendung (2 Zeilen) :}\\ +\verb+\lettrine{E}{in} erstes Beispiel...+ + +\lettrine{E}{in} erstes Beispiel zeigt das Standardverhalten von lettrine. +Es wird eine Initiale über zwei Zeilen produziert, gefolgt vom Text zwischen +den geschweiften Klammern, der als Kapitälchen gesetzt wird. Der weitere +Text umfliesst die Initiale. + +\vspace{\baselineskip} +\textit{Lettrine auf einer Zeile (option {\ttfamily\upshape lines=1}) :}\\ +\verb+\lettrine[lines=1]{E}{in} zweites Beispiel...+ + +\lettrine[lines=1]{E}{in} zweites Beispiel zeigt, wie eine Initiale auf +einer einzelnen Zeile aussieht. Auch hier ist der geklammerte Text in +Kapitälchen gesetzt. + +\vspace{\baselineskip} +\textit{Initiale über drei Zeilen (option {\ttfamily\upshape lines=3}) :}\\ +\verb+\lettrine[lines=3]{E}{in} drittes Beispiel...+ + +\lettrine[lines=3]{E}{in} drittes Beispiel in dem die Initiale über drei +Zeilen gesetzt wird. Beachten Sie die Einrückung der zweiten und dritten +Zeile. Diese kann mit dem Parameter \verb+nindent= + beeinflusst werden. Die +Einrückung der ersten Zeile wird hingegen mit dem Parameter \verb+findent= + +beeinflusst. + +\vspace{\baselineskip} +\textit{Initiale vollständig im Randbereich} :\\ +\verb+\lettrine[lhang=1,findent= .3em,nindent=0pt,lines=3]{V}{erschieben}+ + +\lettrine[lhang=1,findent= .3em,nindent=0pt,lines=3]{V}{erschieben} +wir nun im vierten Beispiel die Initiale in den Randbereich. +Dieses Verhalten wird durch den Parameter \verb+lhang= + gesteuert. + +\vspace{\baselineskip} +\textit{Initiale, vergrössert und teilweise im Randbereich} :\\ +\verb+\lettrine[lines=3, lhang=0.33, loversize=0.25]{A}{uch}+ + +\lettrine[lines=3, lhang=0.33, loversize=0.25]{A}{uch} +die Vergrösserung der Initiale ist möglich. Die Vergrösserung läuft +über die Variable \verb+loversize= + . Sie müssen das Ergebnis nicht +unbedingt schön finden. Es sieht nach meiner Meinung besser aus, wie das +vollständige Verschieben in den Randbereich. + +\vspace{\baselineskip} +\textit{Setzen wir nun eine %französisches + Anführungszeichen davor} :\\ +\verb+\lettrine[ante=\frqq]{M}{it} dem Parameter ...+ + +\lettrine[ante=\frqq]{M}{it} dem Parameter \verb+ante= + kann auch ein +beliebiger Text vor die Initiale gesetzt werden. In der Praxis dürften +wohl nur Anführungszeichen dafür in Frage kommen. + +\vspace{\baselineskip} +\verb+\def\lglqq{\raisebox{-\baselineskip}{\glqq}}+\\ +\verb+\lettrine[ante=\lglqq]{M}{it} dem Parameter ...+ +\def\lglqq{\raisebox{-\baselineskip}{\glqq}} + +\lettrine[ante=\lglqq]{M}{it} dem Parameter \verb+ante= + kann auch ein +beliebiger Text vor die Initiale gesetzt werden. In der Praxis dürften +wohl nur Anführungszeichen dafür in Frage kommen. + +\newpage +\textit{Wir verkleinern die Initiale nun um 10\% und heben sie +um 15\% wegen des {\glqq}Q{\grqq}}:\\ +\verb+\lettrine[lines=4, loversize=-.15, lraise=.15]{Q}{ualität}+ + +\lettrine[lines=4, loversize=-.15, lraise=.15]{Q}{ualität} hat ihren +Preis. Und wenn es nur die Zeit ist, um zu lernen wie Sie solche Spielereien +anstellen können. Bei den Ergebnissen lohnt sich aber die Mühe. Welche +Parameter diesmal was beeinflussen, lasse ich Sie nun selbst herausfinden. +Wie Sie sehen, ragt der Unterstrich des {\glqq}Q{\grqq} nicht in den Text +hinein. + +\vspace{.5\baselineskip} +\textit{Andere Möglichkeit: Nochmal das {\glqq}Q{\grqq} in normaler + Größe aber mit einer Zeile mehr darunter} +\verb+\lettrine[lines=4,depth=1]{Q}{ualität}+ + +\lettrine[lines=4,depth=1]{Q}{ualität} hat ihren Preis. Und wenn es nur die +Zeit ist, um zu lernen wie Sie solche Spielereien anstellen können. Bei den +Ergebnissen lohnt sich aber die Mühe. Welche Parameter diesmal was +beeinflussen, lasse ich Sie nun selbst herausfinden. Wie Sie sehen, ragt der +Unterstrich des {\glqq}Q{\grqq} auch nicht in den Text hinein: eine Zeile mehr +wurde darunter mit \verb+depth=1+ frei gemacht. + +\vspace{.5\baselineskip} +\textit{Verwendung der Option {\ttfamily\upshape slope}}, damit der Text +der Neigung des {\glqq}A{\grqq} folgt:\\ +\verb+\lettrine[lines=4, slope=0.6em, findent=-1em,+\\ +\verb+ nindent=0.6em]{\A}{uch}...+ + +\lettrine[lines=4, slope=0.6em, findent=-1em, nindent=0.6em]{A}{uch} eine +Neigung kann angegeben werden. Damit werden die Löcher neben geneigten +Buchstaben nicht so gross. Selbst eine negative Neigung ist möglich, damit +bietet auch das {\glqq}V{\grqq} keine Schwierigkeiten mehr. Wie das beim +{\glqq}V{\grqq} aussieht, sehen wir uns beim nächsten Beispiel an. + +\vspace{.5\baselineskip} +\textit{Verwendung der Option {\ttfamily\upshape slope}, damit der Text +der Neigung des {\ttfamily\upshape V} folgt; Das {\ttfamily\upshape V} ragt +zusätzlich halb in den Rand hinein +(Option {\ttfamily\upshape lhang=0.5} :})\\ +\verb+\lettrine[lines=4, slope=-0.5em, lhang=0.5, findent=.5em,nindent=0pt]+\\ +\verb+ {V}{iel} ist...+ + +\lettrine[lines=4, slope=-0.5em, lhang=0.5, findent=.5em, nindent=0pt]{V}{iel} +ist hier nicht anders. Nur die negative Neigung und das Hereinragen in den +Rand. Ob Ihnen das Ergebnis gefällt müssen Sie selber entscheiden. +Sie sehen aber, das das {\glqq}V{\grqq} wirklich keine Schwierigkeiten bietet. +Der Unterschied zum vorhergehenden Beispiel ist nicht besonders gross. + +\vspace{.5\baselineskip} +\textit{Ändern wir nun die Schriftfamilie für die Initiale +(hier AvantGarde bold italique):}\\ +\verb+\renewcommand{\LettrineFontHook}{\fontfamily{pag}\fontencoding{T1}%+\\ +\verb+ \fontseries{bx}\fontshape{it}}+\\ +\verb+\lettrine[findent=.3em]{A}{uch} ein Wechsel...+ + +{% (Ändern des lokalen fonts) +\renewcommand{\LettrineFontHook}{\fontfamily{pag}\fontencoding{T1}\fontseries{bx}\fontshape{it}} + +\lettrine[findent=.3em]{A}{uch} ein Wechsel der Schriftfamilie ist problemlos +möglich. Hier verwenden wir Avantgarde und setzen mit der Option +\verb+findent= + den horizontalen Abstand des eingerückten Texts. +\par} + +\vspace{.5\baselineskip} +\textit{Ändern wir nun die Schriftfamilie und die Farbe für die Initiale +(hier yfrak in Grau) :}\\ +\verb+\renewcommand{\LettrineFontHook}{\fontfamily{yfrak}\fontencoding{T1}+\\ +\verb+ \color[gray]{0.5}}\lettrine[loversize=0.1]{A}{uch}...+ + +{% (Aendern des lokalen fonts) +\renewcommand{\LettrineFontHook}{\fontfamily{yfrak}\fontencoding{T1} + \color[gray]{0.5}} + +\lettrine[loversize=0.1]{A}{uch} ein Wechsel der +Schriftfamilie ist problemlos möglich. Hier verwenden wir yfrak, +etwas vergrössert mit der Option \verb+loversize= +, und wir schreiben +die Initiale in Grau mit \verb+\color[gray]{0.5}+. +\par} + +\newpage +\begin{center} +\large\bfseries Verwendung eines PostScript-Bildes als Initiale +\end{center} + +\vspace{\baselineskip} Wenn die erwünschte Initiale nicht als Zeichen eines +Fonts, sondern als Bild im Postscript-Format vorliegt, kann ebenfalls +\verb+\lettrine+ verwendet werden. Es genügt, +die Boolsche Variable \texttt{image=true} zu benützen; z.B. so: + +\vspace{.5\baselineskip} +{% Gruppierung, um die LOKALEN Definitionen zu schützen +\fontfamily{yfrak}\fontencoding{T1}\selectfont\Large +\renewcommand{\LettrineTextFont}{\relax} +\lettrine[image=true, lines=3, lhang=.2, loversize=.25, % + lraise=-.05, findent=0.1em, nindent=0em] +{W}{er} reitet so spät durch Nacht und Wind?\\ +Es ist der Vater mit seinem Kind;\\ +Er hat den Knaben wohl in dem Arm,\\ +Er fa{\ss}t ihn sicher, er hält ihn warm. +\par} + +\vspace{\baselineskip} Und hier der zum Beispiel gehörende \LaTeX{}--Code: +Das erste Argument von \verb+\lettrine+ war \verb+W+. Die Option \texttt{image=true} +lädt dann die Datei \verb+W.eps+. Das Suffix \verb+.eps+ kann -- dank des +Pakets \verb+graphicx.sty+ -- weggelassen werden. + +\begin{verbatim} +{\fontfamily{yfrak}\fontencoding{T1}\selectfont\Large +\renewcommand{\LettrineTextFont}{\relax} +\lettrine[image=true, lines=3, lhang=.2, loversize=.25, % + lraise=-.05, findent=0.1em, nindent=0em] +{W}{er} reitet so spät durch Nacht und Wind? +Es ist der Vater mit seinem Kind; +Er hat den Knaben wohl in dem Arm, +Er fa{\ss}t ihn sicher, er hält ihn warm.\par} +\end{verbatim} + +Zur Darstellung dieses Beispiels müssen folgende Pakete installiert sein: +\begin{itemize} +\item \verb+graphicx.sty+, +\item die Schriften \verb+yfrak.pfb+ im type\,1-Format + von Yannis~\textsc{Haralambous}, +\item das Paket \verb+blacklettert1+ von Thorsten~\textsc{Bronger}. +\end{itemize} + +Die gothische Initiale \glqq W\grqq{} in diesem Beispiel können Sie mit dem +Programm \MP{} aus den \MF{}-Sourcen und \verb+yinitW.mf+ erzeugen. + +Falls Sie eine PDF-Datei erzeugen wollen, müssen Sie die Datei \verb+W.eps+ +in eine PDF-Datei \verb+W.pdf+ umwandeln (mit Hilfe von \verb+epstopdf+). + +\verb+\lettrine+ unterstützt die Verwendung der Formate: +\texttt{pdf}, \texttt{png}, \texttt{jpeg} oder \MP{} als Initiale. + +\vfill +\begin{flushright} + Deutsche Version Georg \textsc{Wagner}\\ + \texttt{g.wagner@datacomm.ch}\\ + Mai 2003, ergänzt September 2014 +\end{flushright} + +\end{document} + +%%% Local Variables: +%%% mode: latex +%%% coding: utf-8 +%%% TeX-master: t +%%% TeX-engine: xetex +%%% End: diff --git a/macros/latex/contrib/lettrine/doc/lettrine-demo-fr.pdf b/macros/latex/contrib/lettrine/doc/lettrine-demo-fr.pdf new file mode 100644 index 0000000000..0d311f197b Binary files /dev/null and b/macros/latex/contrib/lettrine/doc/lettrine-demo-fr.pdf differ diff --git a/macros/latex/contrib/lettrine/doc/lettrine-demo-fr.tex b/macros/latex/contrib/lettrine/doc/lettrine-demo-fr.tex new file mode 100644 index 0000000000..21e525ed06 --- /dev/null +++ b/macros/latex/contrib/lettrine/doc/lettrine-demo-fr.tex @@ -0,0 +1,302 @@ + +\documentclass[paper=a4,12pt,german,french]{scrartcl} +\usepackage{iftex} +\iftutex + \usepackage{fontspec} + \setmainfont{erewhon} +\else + \usepackage[utf8]{inputenc} + \usepackage{fourier} + \renewcommand{\ttdefault}{lmtt} % Courier chasse trop ! +\fi +\usepackage{microtype} +\usepackage{Rothdn, Typocaps} % cfr-initials (p. 3) + +\usepackage{graphicx,color} +\usepackage{lettrine} +\usepackage{babel} +\frenchbsetup{AutoSpacePunctuation=false,og=«,fg=»} + +\newcommand*{\MF}{{\small\scshape metafont}} +\newcommand*{\MP}{{\small\scshape metapost}} +\newcommand*{\file}[1]{\texttt{#1}} +\newcommand*{\cs}[1]{\texttt{\boi#1}} + +\setlength{\parindent}{0pt} +\sloppy +\begin{document} +\thispagestyle{empty} + +\begin{center} +\large\bfseries Quelques exemples de lettrines +\end{center} + +\vspace{\baselineskip} +\textit{Usage standard (2 lignes) :}\\ +\verb+\lettrine{E}{n} plein marais...+ + +\lettrine{E}{n} plein marais de la Souteyranne, à quelques kilomètres +au nord d'Aigues-Mortes, se trouve la Tour Carbonnière. +Construite au XIII\ieme~siècle, elle contrôlait l'unique voie d'accès +terrestre de la ville fortifiée, celle qui menait à Psalmody. + +\vspace{\baselineskip} +\textit{Lettrine sur une seule ligne (option {\ttfamily\upshape lines=1}) :}\\ +\verb+\lettrine[lines=1]{E}{n} plein marais...+ + +\lettrine[lines=1]{E}{n} plein marais de la Souteyranne, +à quelques kilomètres au nord d'Aigues-Mortes, se trouve +la Tour Carbonnière. + +\vspace{\baselineskip} +\textit{Lettrine sur trois lignes (option {\ttfamily\upshape lines=3}) :}\\ +\verb+\lettrine[lines=3]{E}{n} plein marais...+ + +\lettrine[lines=3]{E}{n} plein marais de la Souteyranne, +à juste quelques kilomètres au nord d'Aigues-Mortes, +se trouve la Tour Carbonnière. +Elle contrôlait l'unique voie d'accès +terrestre de la ville fortifiée, celle qui menait à Psalmody, +l'une des « abbayes de sel» dont il ne reste que quelques vestiges. + +\vspace{\baselineskip} +\textit{Lettrine complètement dans la marge} :\\ +\verb+\lettrine[lhang=1, nindent=0pt, lines=3]{J}{ustement},...+ + +\lettrine[lhang=1, nindent=0pt, lines=3]{J}{ustement}, +à quelques kilomètres au nord d'Aigues-Mortes, +se trouve la Tour Carbonnière. +Construite au XIII\ieme~siècle, elle contrôlait l'unique voie d'accès +terrestre de la ville fortifiée, celle qui menait à Psalmody, +l'une des « abbayes de sel» dont il ne reste que quelques vestiges. +L'abbaye était ravitaillée ---~dit-on ~--- par un souterrain +qui la reliait au château de Treillan. + +\vspace{\baselineskip} +\textit{Lettrine en saillie à la fois en hauteur et dans la marge} :\\ +\verb+\lettrine[lines=3, lhang=0.33, loversize=0.25]{E}{n} ...+ + +\lettrine[lines=3, lhang=0.33, loversize=0.25]{E}{n} +plein marais de la Souteyranne, +à quelques kilomètres au nord d'Aigues-Mortes la Tour Carbonnière. +Construite au XIII\ieme~siècle, elle contrôlait l'unique voie d'accès +terrestre de la ville fortifiée, celle qui menait à Psalmody, +l'une des « abbayes de sel» dont il ne reste que des vestiges. + +\vspace{\baselineskip} +\textit{On peut ajouter un guillemet devant la lettrine} :\\ +\verb+\lettrine[ante=«]{E}{n} plein marais ...+ + +\lettrine[ante=«]{E}{n} plein marais de la Souteyranne, +à quelques kilomètres au nord d'Aigues-Mortes, se trouve +la Tour Carbonnière. +Construite au XIII\ieme~siècle, elle contrôlait l'unique voie d'accès +terrestre de la ville fortifiée, celle qui menait à Psalmody. + +\newpage +Toutes Les lettrines suivantes seront en gris jusqu'à nouvel ordre : \\ +\verb+\renewcommand{\LettrineFontHook}{\color[gray]{0.5}}+ +\renewcommand{\LettrineFontHook}{\color[gray]{0.5}} + +\vspace{.5\baselineskip} +\textit{On diminue la taille de la lettrine de 10\% et on +la remonte de 10\% à cause du « Q »} +\verb+\lettrine[lines=4, loversize=-0.1, lraise=0.1]{Q}{u'en...+ + +\lettrine[lines=4, loversize=-0.1, lraise=0.1]{Q}{u'en plein marais} + de la Souteyranne, à quelques kilomètres au nord d'Aigues-Mortes, +se trouve la Tour Carbonnière, surprend les visiteurs. +Construite au XIII\ieme~siècle, elle contrôlait l'unique voie d'accès +terrestre de la ville fortifiée, celle qui menait à Psalmody, +l'une des « abbayes de sel» dont il ne reste que quelques vestiges. +L'abbaye était ravitaillée par un souterrain qui +la reliait au château de Treillan. + +\vspace{.5\baselineskip} +\textit{Autre solution : ajout d’une ligne grâce à} \verb+depth+\\ +\verb+\lettrine[lines=4,depth=1]{Q}{u'en plein marais} de ...+ + +\lettrine[lines=4,depth=1]{Q}{u'en plein marais} de la Souteyranne, +à quelques kilomètres au nord d'Aigues-Mortes, +se trouve la Tour Carbonnière, surprend les visiteurs. +Construite au XIII\ieme~siècle, elle contrôlait l'unique voie d'accès +terrestre de la ville fortifiée, celle qui menait à Psalmody, +l'une des « abbayes de sel» dont il ne reste que quelques vestiges. +L'abbaye était ravitaillée ---~dit-on~--- par un souterrain qui +la reliait au château de Treillan. + +\vspace{.5\baselineskip} +\textit{Utilisation de l'option {\ttfamily\upshape slope}} pour que le texte +suive la pente du « À » :\\ +\verb+\lettrine[lines=4, slope=0.6em, findent=-1em,+\\ +\verb+ nindent=0.6em]{À}{quelques kilomètres}...+ + +\lettrine[lines=4, slope=0.6em, findent=-1em, nindent=0.6em]{À} {quelques +kilomètres} au nord d'Aigues-Mortes, se trouve la Tour Carbonnière. +Construite au XIII\ieme~siècle, elle contrôlait l'unique voie d'accès +terrestre de la ville fortifiée, celle qui menait à Psalmody, +l'une des « abbayes de sel» dont il ne reste que quelques vestiges. +L'abbaye était ravitaillée ---~dit-on~--- par un souterrain qui +la reliait au château de Treillan. + +\vspace{.5\baselineskip} +\textit{Utilisation de l'option {\ttfamily\upshape slope} pour que le texte + suive la pente du {\ttfamily\upshape V}, noter que celui-ci est à + demi-poussé dans la marge par l'option {\ttfamily\upshape lhang=0.5} :}\\ +\verb+\lettrine[lines=4, slope=-0.5em, lhang=0.5, findent=.5em, nindent=0pt]+\\ +\verb+ {V}{oici} à...+ + +\lettrine[lines=4, slope=-0.5em, lhang=0.5, findent=.5em, nindent=0pt]{V}{oici} +à quelques kilomètres au nord d'Aigues-Mortes la Tour Carbonnière. +Construite au XIII\ieme~siècle, elle contrôlait l'unique voie d'accès +terrestre de la ville fortifiée, celle qui menait à Psalmody, +l'une des « abbayes de sel» dont il ne reste que quelques vestiges. +L'abbaye était ravitaillée ---~dit-on~--- par un souterrain qui +la reliait au château de Treillan distant de quelques kilomètres à peine. + +\newpage + +\begin{center} +\large\bfseries Deux exemples d’utilisation de cfr-initials +\end{center} + +\textit{Dans le préambule :} +\verb+\usepackage{Typocaps, Rothdn}+ + +\vspace{.5\baselineskip} +\textit{Changement de police (ici Typocaps) + et de couleur pour la lettrine :}\\ +\verb+\renewcommand{\LettrineFontHook}{\Typocapsfamily\color{red}}+\\ +\verb+\lettrine[findent=.3em]{E}{n} plein marais...+ + +{% Groupe (changement local de fonte) +\renewcommand{\LettrineFontHook}{\Typocapsfamily\color{red}} + +\lettrine[findent=.3em]{E}{n} plein marais de la Souteyranne, à quelques +kilomètres au nord d'Aigues-Mortes, se trouve la Tour Carbonnière. +Construite au XIII\ieme~siècle, elle contrôlait l'unique voie d'accès +terrestre de la ville fortifiée. +\par}% Fin du groupe. + +\vspace{.5\baselineskip} +\textit{Les quatre exemples suivants font appel à la police d’initiales Rothdn}\\ +\verb+\renewcommand{\LettrineFontHook}{\Rothdnfamily}+ + +\renewcommand{\LettrineFontHook}{\Rothdnfamily} + +\vspace{.5\baselineskip} + +\textit{Le calcul de la taille de la lettrine prend normalement comme + référence les lettres EFTZ (voir {\upshape\cs{LettrineTestString}}), + dans le cas de la police Rothdn ça donne ceci pour A : } + +\verb+\lettrine[lines=3]{A}{u} bord du marais+ + +\lettrine[lines=3]{A}{u} bord du marais de la Souteyranne, à quelques +kilomètres au nord d'Aigues-Mortes, se trouve la Tour Carbonnière. +Construite au XIII\ieme~siècle, elle contrôlait l'unique voie d'accès +terrestre de la ville fortifiée, celle qui menait à Psalmody, +l'une des « abbayes de sel» dont il ne reste que quelques vestiges. + +\vspace{\baselineskip} +\textit{L’option {\ttfamily\upshape refstring} donne une taille correcte à la + lettrine (le calcul est fait sur la base du A lui-même et non de EFTZ% + \footnote{Le F de la police Rothdn a une hauteur supérieure à celles des + autres lettres.} : +} + +\verb+\lettrine[refstring, lines=3]{A}{u} bord du marais+ + +\lettrine[refstring, lines=3]{A}{u} bord du marais de la Souteyranne, +à quelques kilomètres au nord d'Aigues-Mortes, se trouve la Tour Carbonnière. +Construite au XIII\ieme~siècle, elle contrôlait l'unique voie d'accès +terrestre de la ville fortifiée, celle qui menait à Psalmody, +l'une des « abbayes de sel» dont il ne reste que quelques vestiges. + + +\vspace{\baselineskip} +\textit{Il suffit maintenant de remonter la lettrine + ({\ttfamily\upshape lraise=0.15}) pour compenser sa profondeur : +} + +\verb+\lettrine[refstring, lraise=0.15, lines=3]{A}{u} bord du marais+ + +\lettrine[refstring, lraise=0.15, lines=3]{A}{u} bord du marais de la +Souteyranne, à quelques kilomètres au nord d'Aigues-Mortes, se trouve +la Tour Carbonnière. +Construite au XIII\ieme~siècle, elle contrôlait l'unique voie d'accès +terrestre de la ville fortifiée, celle qui menait à Psalmody, +l'une des « abbayes de sel» dont il ne reste que quelques vestiges. + +\newpage +\begin{center} +\large\bfseries Utilisation d'une image comme lettrine +\end{center} + +\vspace{\baselineskip} +Si la lettrine souhaitée n'est pas un caractère d'une fonte mais une +image, \verb+\lettrine+ peut encore être utilisée, il suffit +d'utiliser le booléen \texttt{image}, exemple : + +\begin{otherlanguage}{german} +\renewcommand{\LettrineTextFont}{\relax} +\fontfamily{yfrak}\fontencoding{T1}\selectfont\Large +\lettrine[image=true,lhang=.2, loversize=.25, findent=0.1em] +{W}{er} reitet so spät durch Nacht und Wind?\\ +Es ist der Vater mit seinem Kind;\\ +Er hat den Knaben wohl in dem Arm,\\ +Er fa{\ss}t ihn sicher, er hält ihn warm.\par +\end{otherlanguage} + +\vspace{.5\baselineskip} +Et voici le code \LaTeX{} correspondant ; +le premier argument de \verb+\lettrine+ étant \verb+W+, +\verb+\lettrine+ fait appel au fichier \verb+W.pdf+, \verb+W.jpg+, etc. en +pdfLaTeX (omission possible du suffixe \verb+.eps+, \verb+.pdf+, propriété +de \verb+graphicx.sty+). + +\begin{verbatim} +\begin{otherlanguage}{german} + \fontfamily{yfrak}\fontencoding{T1}\selectfont\Large + \renewcommand{\LettrineTextFont}{\relax} + \lettrine[image=true,lhang=.2, loversize=.25, findent=0.1em] + {W}{er} reitet so spät durch Nacht und Wind?\\ + Es ist der Vater mit seinem Kind;\\ + Er hat den Knaben wohl in dem Arm,\\ + Er fa{\ss}t ihn sicher, er hält ihn warm.\par +\end{otherlanguage} +\end{verbatim} + +Pour la compilation en pdfLaTeX cet exemple fait appel aux fichiers suivants : +\begin{itemize} +\item \texttt{graphicx.sty} (extension standard \LaTeXe{}), +\item \texttt{blackletter1} de Thorsten~\textsc{Bronger} (disponible sur CTAN), +\item les fontes gothiques « Fraktur » de Yannis~\textsc{Haralambous} type\,1 + \texttt{yfrak.pfb} disponibles sur CTAN). +\end{itemize} +L'initiale gothique « W » utilisée dans +cet exemple a été créée par \MP{} (fichier \texttt{W.pdf} ci-joint) +à partir du source \MF{} \texttt{yinitW.mf} de Yannis grâce aux précieuses +indications de Denis~\textsc{Roegel} que je remercie bien vivement. + +\vspace{.5\baselineskip} +Une solution plus simple s’offre aux utilisateurs de LuaLaTeX ou XeLaTeX pour +reproduire le poème ci-dessus : il suffit d’utiliser la police OpenType Yinit +pour la lettrine et par exemple une des polices OpenType UnifrakturMaguntia +pour le texte, voir le fichier \file{demo-lua.pdf}. + +\vfill +\begin{flushright} + Daniel \textsc{Flipo}\\ + \texttt{daniel.flipo@free.fr}\\ + mars 2020. +\end{flushright} + +\end{document} + +%%% Local Variables: +%%% mode: latex +%%% coding: utf-8 +%%% TeX-master: t +%%% TeX-engine: xetex +%%% End: diff --git a/macros/latex/contrib/lettrine/doc/lettrine-demo-lua.pdf b/macros/latex/contrib/lettrine/doc/lettrine-demo-lua.pdf new file mode 100644 index 0000000000..e8c19c69d4 Binary files /dev/null and b/macros/latex/contrib/lettrine/doc/lettrine-demo-lua.pdf differ diff --git a/macros/latex/contrib/lettrine/doc/lettrine-demo-lua.tex b/macros/latex/contrib/lettrine/doc/lettrine-demo-lua.tex new file mode 100644 index 0000000000..4492ade68e --- /dev/null +++ b/macros/latex/contrib/lettrine/doc/lettrine-demo-lua.tex @@ -0,0 +1,116 @@ +\documentclass[12pt,paper=a4,german,french,british]{scrartcl} + +\usepackage{lettrine} +\usepackage[dvipsnames]{xcolor} +\usepackage[colorlinks, urlcolor=ForestGreen, linkcolor=blue]{hyperref} + +%%% Linux Libertine fonts... +\usepackage{fontspec} +\setmainfont{Linux Libertine O} +%\setsansfont{TeX Gyre Heros}[Scale=MatchLowercase] +\setmonofont{Latin Modern Mono}[Scale=MatchLowercase] + +\usepackage{Typocaps} + +\usepackage{babel} +\frenchbsetup{AutoSpacePunctuation=false, og=«,fg=»} +\babeltags{fr=french, de=german, uk=british} + +\newcommand*{\file}[1]{\texttt{#1}} +\newcommand*{\cs}[1]{\texttt{\boi#1}} +\newcommand*{\MF}{{\small\scshape metafont}} + +\setlength{\parindent}{0pt} +\sloppy + +\begin{document} +\thispagestyle{empty} +\enlargethispage{2\baselineskip} + +\begin{center} +\large\bfseries Some LuaLaTeX examples +\end{center} + +Both files \file{demo-fr.tex} and \file{demo-de.tex} can be compiled either with +pdfLaTeX or with LuaLaTeX or XeLaTeX. The purpose of the next examples is to +show how easy it is to change the font for the dropped initial with Unicode +engines: no need to care about the low-level NFSS syntax, a simple +\cs{fontspec} call will do the trick. + +\vspace{.5\baselineskip} +In the first example, \textit{ Linux Libertine Initials} is used for the +dropped capital:\\ +\verb+\renewcommand{\LettrineFontHook}{\fontspec{LinLibertine_I.otf}}+\\ +\verb+\lettrine[lines=3]{E}{n plein marais de la Souteyranne...}+ + +\begin{fr} + \renewcommand{\LettrineFontHook}{\fontspec{LinLibertine_I.otf}} + \lettrine[lines=3]{E}{n plein marais de la Souteyranne}, à quelques + kilomètres au nord d'Aigues-Mortes, se trouve la Tour Carbonnière. + Construite au XIII\ieme~siècle, elle contrôlait l'unique voie d'accès + terrestre de la ville fortifiée, celle qui menait à Psalmody, + l'une des « abbayes de sel» dont il ne reste que quelques vestiges.\par +\end{fr} + +\vspace{.5\baselineskip} +Of course, it is still possible to use Type\,1 fonts for the dropped capitals, +here \textit{Typocaps} (red):\\ +\verb+\renewcommand{\LettrineFontHook}{\Typocapsfamily\color{red}}+\\ +\verb+\lettrine[findent=.3em]{E}{n plein marais de la Souteyranne}...+ + +\begin{fr} +\renewcommand{\LettrineFontHook}{\Typocapsfamily\color{red}} +\lettrine[findent=.3em]{E}{n plein marais de la Souteyranne}, à quelques +kilomètres au nord d'Aigues-Mortes, se trouve la Tour Carbonnière. +Construite au XIII\ieme~siècle, elle contrôlait l'unique voie d'accès +terrestre de la ville fortifiée.\par +\end{fr} + +\vspace{.5\baselineskip} +OpenType and TrueType free fonts are available for Old German, here is an example +featuring the \textit{Yinit} OpenType font% +\footnote{produced by Élie Roux from Yannis Haralambous’ Gothic Initials + originally in \MF.} +for the initial and \textit{UnifrakturMaguntia} TrueType font% +\footnote{\url{http://unifraktur.sourceforge.net/maguntia.html}} +for the running text. The later has several nice \textit{optional features}, +(here long s and old umlaut variant): + +\verb+\setmainfont{UnifrakturMaguntia.ttf}[StylisticSet=11,CharacterVariant=15]+\\ +\verb+\renewcommand{\LettrineTextFont}{\relax} % No small caps here!+ \\ +\verb+\renewcommand{\LettrineFontHook}{\fontspec{Yinit.otf}}+\\ +\verb+\lettrine[lhang=.2, loversize=.25, findent=0.1em]{W}{er} reitet+ + +\begin{de}\Large +\setmainfont{UnifrakturMaguntia.ttf}[StylisticSet=11,CharacterVariant=15] +\renewcommand{\LettrineTextFont}{\relax} +\renewcommand{\LettrineFontHook}{\fontspec{Yinit.otf}} +\lettrine[lhang=.2, loversize=.25, findent=0.1em] +{W}{er} reitet so spät durch Nacht und Wind?\\ +Es ist der Vater mit seinem Kind;\\ +Er hat den Knaben wohl in dem Arm,\\ +Er faßt ihn sicher, er hält ihn warm.\par +\end{de} + +\vspace{.5\baselineskip} +Without the \textit{optional features}, the output looks more modern: + +\begin{otherlanguage}{german}\Large +\setmainfont{UnifrakturMaguntia.ttf} +\renewcommand{\LettrineTextFont}{\relax} +\renewcommand{\LettrineFontHook}{\fontspec{Yinit.otf}} +\lettrine[lhang=.2, loversize=.25, findent=0.1em] +{W}{er} reitet so spät durch Nacht und Wind?\\ +Es ist der Vater mit seinem Kind;\\ +Er hat den Knaben wohl in dem Arm,\\ +Er faßt ihn sicher, er hält ihn warm.\par +\end{otherlanguage} + +\end{document} + +%%% Local Variables: +%%% mode: latex +%%% coding: utf-8 +%%% TeX-master: t +%%% TeX-engine: luatex +%%% End: diff --git a/macros/latex/contrib/lettrine/doc/lettrine.pdf b/macros/latex/contrib/lettrine/doc/lettrine.pdf index 5660e16e1b..6870682712 100644 Binary files a/macros/latex/contrib/lettrine/doc/lettrine.pdf and b/macros/latex/contrib/lettrine/doc/lettrine.pdf differ diff --git a/macros/latex/contrib/lettrine/lettrine.dtx b/macros/latex/contrib/lettrine/lettrine.dtx index c357e97aba..65f301e6af 100644 --- a/macros/latex/contrib/lettrine/lettrine.dtx +++ b/macros/latex/contrib/lettrine/lettrine.dtx @@ -1,8 +1,6 @@ -% \CheckSum{650} -% % \iffalse meta-comment % -% Copyright © 1999-2020 Daniel Flipo. +% Copyright © 1999-2022 Daniel Flipo. % % This program can be distributed and/or modified under the terms % of the LaTeX Project Public License either version 1.3c of this @@ -26,7 +24,7 @@ \ProvidesFile{lettrine.dtx} % %<*!cfg> - [2020-03-14 v2.23 (Daniel Flipo)] + [2022-09-25 v2.30 (Daniel Flipo)] % % % Lettrine package for LaTeX version 2e @@ -36,6 +34,8 @@ % Please report errors to: daniel (dot) flipo (at) free (dot) fr % %<*driver> +\RequirePackage{pdfmanagement-testphase} +\DeclareDocumentMetadata{pdfstandard=A-2b, lang=en-US} \documentclass[a4paper]{ltxdoc} \usepackage[dvipsnames]{xcolor} \usepackage{unicode-math} @@ -48,7 +48,10 @@ \usepackage[expansion=true,protrusion=true]{microtype} \usepackage{url} \usepackage[numbered]{hypdoc} -\hypersetup{colorlinks,urlcolor=blue,unicode} +\hypersetup{pdftitle={Lettrine User’s Guide}, + pdfauthor={Daniel FLIPO}, + colorlinks + } \usepackage{lettrine} \usepackage{tikz} \usetikzlibrary{shapes.arrows} @@ -92,15 +95,16 @@ % % \changes{v2.23}{2020/03/14}{Documentation cleanup.} % -% Adding |\usepackage{lettrine}| in the preamble of a document +% Adding |\usepackage{lettrine}| in the preamble of a document % defines the command |\lettrine|, the simplest use of which is % |\lettrine{|\meta{letter}|}{|\meta{text}|}|. % It produces a dropped capital \meta{letter} (2 lines high), % followed by \meta{text} typeset in small caps, and the rest % of the paragraph is wrapped around the dropped capital. % -% Various parameters are provided to control the size and layout -% of the dropped capital and match the requirements described +% The |\lettrine[|\meta{options}|]{|\meta{letter}|}{|\meta{text}|}| +% command accepts various optional arguments to control the size and +% layout of the dropped capital and match the requirements described % in the books % \begin{itemize} % \item ``Lexique des règles typographiques en usage à @@ -149,7 +153,7 @@ % \changes{v1.6}{2004/05/22}{Add a flag to switch to % images in eps or pdf format. Suggested by Bill Jetzer.} % -% \item \lopt{image=true} will force |\lettrine| to replace the letter +% \item \lopt{image[=true]} will force |\lettrine| to replace the letter % normally used as dropped capital by an image in eps format (latex) % or in pdf, jpg, etc.\ format (pdflatex, xelatex, lualatex); % this requires the |graphicx| package to be loaded in the preamble. @@ -163,13 +167,13 @@ % \changes{v1.8}{2015/02/06}{Added two keyval options: % `grid’ (true/false) and `novskip’ to override \cs{DiscardVskip}.} % -% \item \lopt{grid=true} will force the vertical skip added above the +% \item \lopt{grid[=true]} will force the vertical skip added above the % paragraph starting with |\lettrine| to be rounded up to an integer % number of |\baselineskip|. This option is meant for grid % typesetting. % \item \lopt{novskip=}\meta{dimen} overrides |\DiscardVskip| % (default=0.2pt). In some cases (see options \lopt{lraise}, -% \lopt{loversize} or accentuated dropped capitals,\dots) the top of +% \lopt{loversize} or accentuated dropped capitals,…) the top of % the dropped capital will raise above the top of following text % (usually in small caps), this will trigger a corresponding vertical % skip above the paragraph starting with |\lettrine|, \emph{only if} @@ -180,7 +184,7 @@ % \changes{v1.9}{2015/08/31}{New keyval option: `realheight’ % (true/false) and new global flag \cs{ifLettrineRealHeight}.} % -% \item \lopt{realheight=true} will compute the default height of the +% \item \lopt{realheight[=true]} will compute the default height of the % initial so that the top of it is exactly aligned with the top of % the text entered as second mandatory argument of |\lettrine| % taking possible accents into account. Otherwise, the default @@ -212,7 +216,7 @@ % \lopt{refstring=}\meta{string} to override \cs{LettrineTestString} % locally.} is meant for fancy initials with % irregular heights (i.e.\ taken in fonts like Yinit (OpenType), -% \file{cfr-initials},\dots). \lopt{refstring} forces the +% \file{cfr-initials},…). \lopt{refstring} forces the % |\fontsize| computations to be run on the initial given as % |\lettrine|’s first mandatory argument instead of the reference % string |\LettrineTestString|. In most cases, this option should @@ -224,7 +228,7 @@ % Example: |\lettrine[lines=4, lraise=0.1, nindent=0em, |% % |slope=-.5em]%|\\ % \mbox{}\phantom{\tt Example: lettrine}% -% |{V}{oici} un exemple |\dots +% |{V}{oici} un exemple |… % % Coloured initials are possible in conjonction with package % \file{color}, examples: \\ @@ -237,46 +241,54 @@ % Three dimensions, |\LettrineWidth|, |\LettrineHeight| and % |\LettrineDepth|, store the final size of the initial. % -% Once \file{lettrine.sty} will be installed (run \texttt{lualatex} -% on \file{lettrine.ins} to extract it), compile \file{demo-fr.tex} -% and \file{demo-lua.tex} print the resulting PDFs to see the +% Have a look at files \file{demo-fr.tex} and \file{demo-lua.tex} +% and at the resulting PDFs in the \file{doc} folder to see the % possible usage of these parameters. % % \changes{v1.9}{2015/08/31}{New customisable string % \cs{LettrineSecondString} to tune the initial’s height.} % -% The default settings can be customized either in a config file -% \file{lettrine.cfg} (for a global usage), or on a per document -% basis, in the preamble of each document. The following list -% shows the syntax to set them and their default values: +% Starting with version~2.30, the default settings can be +% specified as options passed to the \pkg{lettrine} \emph{package}. +% These options are the same as those of the |\lettrine| command% +% \footnote{With one exception: \lopt{refstring} is available only +% for the \cs{lettrine} command.}: +% f.i. |\usepackage[lines=3]{lettrine}| will set the default to three +% lines of text. Options passed to the \pkg{lettrine} package override +% the defaults set in the \file{lettrine.cfg} file (see below) and will +% be overriden by options passed to the |\lettrine| command. +% +% The default settings can be customized in a config file +% \file{lettrine.cfg} for a global usage. The following list shows +% the syntax to set them and their default values: % \begin{itemize} % \item |\setcounter{DefaultLines}{2}|, % \item |\setcounter{DefaultDepth}{0}|, % \item |\renewcommand*{\DefaultLoversize}{0}|, % \item |\renewcommand*{\DefaultLraise}{0}|, % \item |\renewcommand*{\DefaultLhang}{0}|, -% \item |\LettrineImagefalse|, -% \item |\LettrineOnGridfalse|, -% \item |\LettrineRealHeightfalse|, -% \item |\LettrineSelfReffalse|, % \item |\setlength{\DefaultFindent}{0pt}|, % \item |\setlength{\DefaultNindent}{0.5em}|, % \item |\setlength{\DefaultSlope}{0pt}|. -% \item |\setlength{\DiscardVskip}{0.2pt}|. +% \item |\setlength{\DiscardVskip}{0.2pt}|, +% \item |\LettrineImagefalse|, +% \item |\LettrineOnGridfalse|, +% \item |\LettrineRealHeightfalse|. % \end{itemize} % % Instead of giving optional parameters to the |\lettrine| command, -% it is possible, from version 1.5, to set them on a per character +% it is possible to set them on a per character % basis in a second config file (suggested by Pascal Kockaert): -% |\renewcommand{\DefaultOptionsFile}{|\textit{filename}|}| +% |\renewcommand{\DefaultOptionsFile}{|\meta{filename}|}| % in the preamble (or anywhere in the document) will -% force each call to |\lettrine| to read the file \textit{filename}. -% See examples of such config files in the subdirectory -% \file{contrib}. +% force each call to |\lettrine| to read the file \meta{filename}. +% Alternatively, |\usepackage[optionsfile=|\meta{filename}|]{lettrine}| +% produces the same effect. +% See examples of such config files in the subdirectory \file{contrib}. % % The dimensional parameters \lopt{findent}, \lopt{nindent} and -% \lopt{slope}, can be set in \textit{filename} relative to -% |\LettrineWidth| if needed. The settings read from this file +% \lopt{slope}, can be set relative to |\LettrineWidth| if needed, +% \emph{in \meta{filename} only}. The settings read from this file % will be overridden by the optional arguments eventually given to % |\lettrine|. % @@ -299,13 +311,13 @@ % low-level font interface (see LaTeX Companion, p.187--192), % the |\selectfont| command is issued by |\LettrineFont|:\\ % |\renewcommand{\LettrineFontHook}{\fontfamily{ppl}|\ignorespaces -% |\fontseries{bx}}%|\\ -% | \fontshape{sl}}|,\\ +% |\fontseries{bx}%|\\ +% | \fontshape{sl}}|\\ % selects Palatino bold expanded slanted for the dropped capital. % % With LuaLaTeX or XeLaTeX changing the lettrine’s font is % even easier, simply use the |\fontspec| command:\\ -% |\renewcommand{\LettrineFontHook}{\fontspec{LinLibertine_I.otf}|\\ +% |\renewcommand{\LettrineFontHook}{\fontspec{LinLibertine_I.otf}}|\\ % will switch to Linux Libertine Initials. % % |\LettrineFontHook| can also be used to change the colour of @@ -346,7 +358,7 @@ % hyphenation). % % You can also consider using one of the standard PostScript fonts -% (Palatino, Times, Utopia\dots), or any OpenType font, they are +% (Palatino, Times, Utopia…), or any OpenType font, they are % fully scalable too! % % \newpage{} @@ -419,10 +431,10 @@ % \end{macrocode} % % This package only runs with LaTeX and requires files -% \file{keyval.sty} and \file{minifp.sty}. +% \file{xkeyval.sty} and \file{minifp.sty}. % % \begin{macrocode} -\RequirePackage{keyval,minifp} +\RequirePackage{xkeyval,minifp} % \end{macrocode} % % Default initializations: define the necessary counters, lengths, @@ -442,8 +454,7 @@ % \changes{v2.1}{2018/08/14}{Newif \cs{ifLettrineVone} and % new option `Vone’ (removed in v2.2, rollback prefered).} % -% \changes{v2.1}{2018/08/14}{New option `refstring’ and newif -% \cs{ifLettrineSelfRef}.} +% \changes{v2.1}{2018/08/14}{New option `refstring’.} % % \begin{macrocode} \newcounter{DefaultLines} @@ -464,9 +475,44 @@ \newif\ifLettrineImage \newif\ifLettrineOnGrid \newif\ifLettrineRealHeight -\newif\ifLettrineSelfRef % \end{macrocode} % +% Load a local config file if present in LaTeX’s search path. +% \begin{macrocode} +\InputIfFileExists{lettrine.cfg} + {\typeout{Loading lettrine.cfg}} + {\typeout{lettrine.cfg not found, using default values}} +% \end{macrocode} +% +% \changes{v2.30}{2022/09/23}{Added global options to package +% \pkg{lettrine}.} +% +% Global package options enable to override the default values given +% above to generic parameters. These may be overriden again by +% options passed to the |\lettrine[]{}{}| command. +% \begin{macrocode} +\DeclareOptionX{lines}[\value{DefaultLines}]{\setcounter{DefaultLines}{#1}} +\DeclareOptionX{depth}[\value{DefaultDepth}]{\setcounter{DefaultDepth}{#1}} +\DeclareOptionX{lhang}[]{\ifx#1\@empty\else + \renewcommand*{\DefaultLhang}{#1}\fi} +\DeclareOptionX{loversize}[]{\ifx#1\@empty\else + \renewcommand*{\DefaultLoversize}{#1}\fi} +\DeclareOptionX{lraise}[]{\ifx#1\@empty\else + \renewcommand*{\DefaultLraise}{#1}} +\DeclareOptionX{findent}[\the\DefaultFindent]{% + \setlength{\DefaultFindent}{#1}} +\DeclareOptionX{nindent}[\the\DefaultNindent]{% + \setlength{\DefaultNindent}{#1}} +\DeclareOptionX{slope}[\the\DefaultSlope]{\setlength{\DefaultSlope}{#1}} +\DeclareOptionX{image}[true]{\csname LettrineImage#1\endcsname} +\DeclareOptionX{grid}[true]{\csname LettrineOnGrid#1\endcsname} +\DeclareOptionX{novskip}[\the\DiscardVskip]{\setlength{\DiscardVskip}{#1}} +\DeclareOptionX{realheight}[true]{\csname LettrineRealHeight#1\endcsname} +\DeclareOptionX{optionsfile}[]{\ifx#1\@empty\else + \renewcommand*{\DefaultOptionsFile}{#1}\fi} +\ProcessOptionsX +% \end{macrocode} + % Then let’s define the necessary internal counters, lengths, % and commands. % @@ -653,10 +699,11 @@ % \changes{v2.22}{2018/09/14}{Warn if \cs{fontsize} computation fails % due to division by 0.} % -% When optional argument \lopt{selfref} is \lopt{true} the initial -% itself is taken as reference to compute |\fontsize|, this can be -% handy when working with fancy fonts (i.e.\ cfr-initials, Yinit). -% In most cases, the default is a better choice. +% The conditional |\ifL@selfref| is set to \lopt{true} by |\lettrine| +% option \lopt{refstring}, then the initial itself is taken as +% reference to compute |\fontsize|, this can be handy when working +% with fancy fonts (i.e.\ cfr-initials, Yinit). In most cases, the +% default is a better choice. % \begin{macrocode} \def\compute@fontsize{% \ifL@selfref @@ -700,10 +747,10 @@ % \begin{macro}{\LettrineImage} % The following definition is for use with dropped capitals defined % as images: EPS, PDF, JPG, PNG files (see examples in demo-fr.tex). -% Its use requires the |graphicx| package to be loaded in the -% preamble with |\usepackage{graphicx}|. The required size is -% computed just as in the standard case, |\includegraphics| -% prints the image at this size. +% Its requires the |graphicx| package to be loaded in the +% preamble with |\usepackage{graphicx}|. The image’s height is +% computed just as in the standard case and passed to +% |\includegraphics|. % % \changes{v1.6}{2004/05/22}{Added \cs{LettrineFontHook} % to \cs{LettrineFontEPS}. This is needed for color options.} @@ -731,7 +778,7 @@ % \end{macrocode} % \end{macro} % -% Set up keyval initializations. +% Set up keyval initializations for the |\lettrine| command. % % \begin{macrocode} \define@key{L}{lines}{\setcounter{L@lines}{#1}} @@ -797,7 +844,6 @@ \ifLettrineImage\L@imagetrue\else\L@imagefalse\fi \ifLettrineOnGrid\L@gridtrue\else\L@gridfalse\fi \ifLettrineRealHeight\L@realhtrue\else\L@realhfalse\fi - \ifLettrineSelfRef\L@selfreftrue\else\L@selfreffalse\fi % \end{macrocode} % % The final initial size depends on the height of |\L@tbox|; the @@ -831,7 +877,7 @@ % |\DefaultOptionsFile|), do this inside a group, and define a % global command |\l@LOKeys| which will expand to the list of % options given by |\LettrineOptionsFor| for the current initial -% (defined by |#2|)\dots +% (defined by |#2|)… % \begin{macrocode} \if\DefaultOptionsFile\relax \else @@ -1005,7 +1051,7 @@ % % \changes{v1.1}{1999/08/18}{Add \cs{rightmargin} to % \cs{L@Pindent} for \cs{Lettrine} to work properly in quote, -% quotation, abstract environments\dots{} but do not change +% quotation, abstract environments… but do not change % \cs{linewidth} which is set by these environments.} % % \changes{v1.4}{2002/10/26}{\cs{lettrine} still didn’t @@ -1017,7 +1063,7 @@ % \changes{v2.22}{2019/04/04}{\cs{@totalleftmargin} is the correct % indentation for quote, quotation and abstract environments.} % -% This is for quotation, quote, abstract\dots{} environments: +% This is for quotation, quote, abstract… environments: % |\linewidth| is set by these environments, all we have to do % is to shift our text left by |\@totalleftmargin|. % \begin{macrocode} @@ -1080,12 +1126,6 @@ } % \end{macrocode} % -% Load a local config file if present in LaTeX’s search path. -% \begin{macrocode} -\InputIfFileExists{lettrine.cfg} - {\typeout{Loading lettrine.cfg}} - {\typeout{lettrine.cfg not found, using default values}} -% \end{macrocode} % \iffalse % % \fi @@ -1123,7 +1163,6 @@ %%\LettrineImagefalse %%\LettrineOnGridfalse %%\LettrineRealHeightfalse -%%\LettrineSelfReffalse %% %% Theses are *commands* (value=string, only height matters): %%\renewcommand*{\LettrineTestString}{EFTZ} @@ -1137,30 +1176,6 @@ % % \fi % -% \iffalse -%<*dtx> -% \fi -%% -%% \CharacterTable -%% {Upper-case \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z -%% Lower-case \a\b\c\d\e\f\g\h\i\j\k\l\m\n\o\p\q\r\s\t\u\v\w\x\y\z -%% Digits \0\1\2\3\4\5\6\7\8\9 -%% Exclamation \! Double quote \" Hash (number) \# -%% Dollar \$ Percent \% Ampersand \& -%% Acute accent \' Left paren \( Right paren \) -%% Asterisk \* Plus \+ Comma \, -%% Minus \- Point \. Solidus \/ -%% Colon \: Semicolon \; Less than \< -%% Equals \= Greater than \> Question mark \? -%% Commercial at \@ Left bracket \[ Backslash \\ -%% Right bracket \] Circumflex \^ Underscore \_ -%% Grave accent \` Left brace \{ Vertical bar \| -%% Right brace \} Tilde \~} -%% -% \iffalse -% -% \fi -% % \Finale \endinput diff --git a/macros/latex/contrib/lettrine/lettrine.ins b/macros/latex/contrib/lettrine/lettrine.ins index 8c605c8aad..4c0c40bc7b 100644 --- a/macros/latex/contrib/lettrine/lettrine.ins +++ b/macros/latex/contrib/lettrine/lettrine.ins @@ -1,5 +1,5 @@ %% -%% Copyright (C) 1999-2020 Daniel Flipo. +%% Copyright (C) 1999-2022 Daniel Flipo. %% %% This file will generate fast loadable files and documentation %% driver files from the doc files in this package when run through diff --git a/macros/latex/contrib/semantex/README.md b/macros/latex/contrib/semantex/README.md index 85732053e6..44c5fb7ac0 100644 --- a/macros/latex/contrib/semantex/README.md +++ b/macros/latex/contrib/semantex/README.md @@ -25,7 +25,7 @@ Released under the LaTeX Project Public License v1.3c or later See http://www.latex-project.org/lppl.txt ---------------------------------------------------------------- -Copyright (C) 2021 by Sebastian Ørsted +Copyright (C) 2022 by Sebastian Ørsted The package is loaded via \usepackage{semantex} diff --git a/macros/latex/contrib/semantex/semantex.pdf b/macros/latex/contrib/semantex/semantex.pdf index 2ed542a06f..4e50ebe1d4 100644 Binary files a/macros/latex/contrib/semantex/semantex.pdf and b/macros/latex/contrib/semantex/semantex.pdf differ diff --git a/macros/latex/contrib/semantex/semantex.sty b/macros/latex/contrib/semantex/semantex.sty index 8cdbecc789..ed347ffb6a 100644 --- a/macros/latex/contrib/semantex/semantex.sty +++ b/macros/latex/contrib/semantex/semantex.sty @@ -1,5 +1,5 @@ \RequirePackage{xparse,l3keys2e,leftindex,semtex} -\ProvidesExplPackage{semantex}{2022/06/22}{0.520}{} +\ProvidesExplPackage{semantex}{2022/09/24}{0.521}{} %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % % @@ -10,7 +10,7 @@ % % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -\tl_set:Nn\SemantexVersion{0.520} +\tl_set:Nn\SemantexVersion{0.521} \cs_set_eq:NN \semantex_keyval_parse:NNn \keyval_parse:NNn \cs_set:Npn \semantex_singlekey_parse:Nn#1#2 { \clist_map_function:nN { #2 } #1 } @@ -148,7 +148,7 @@ % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -\cs_new_protected:Npn\semantex_declare_simple_class:N#1 % new simple-type class +\cs_new_protected:Npn\semantex_define_simple_class:N#1 % new simple-type class { % #1 = class name \DeclareDocumentCommand{#1}{m} @@ -167,49 +167,84 @@ ##1 } } - \exp_args:Nc\DeclareDocumentCommand{__semantex_declare_object_of_\semantex_class_to_register:N #1:Nw}{mgO{}} + \cs_set_protected:cpn { __semantex_define_object_of_\semantex_class_to_register:N #1:N } ##1 { - % the command for creating a new object of class #1 - % ##1 = command name, with backslash + % create the object with name ##1 + \DeclareDocumentCommand{##1}{} + { + \semantex_write_original_source_to_semtex_file:n { ##1 } + \semantex_render_object:Nn ##1 { } + } + } + \exp_args:Nc\DeclareDocumentCommand{__semantex_new_object_of_\semantex_class_to_register:N #1:Nw}{mgO{}} + { + % declare object of class #1 + % ##1 = object name % ##2 = symbol % ##3 = options \IfValueTF{##2} { - \semantex_declare_object:NNn #1 ##1 { + \semantex_new_object_and_do:NNnn #1 ##1 { \semantex_object_set_symbol:Nn ##1 { ##2 } \semantex_object_set_keys:Nn ##1 { ##3 } } + { + \use:c { __semantex_define_object_of_\semantex_class_to_register:N #1:N } ##1 + } } { - \semantex_declare_object:NNn #1 ##1 { + \semantex_new_object_and_do:NNnn #1 ##1 { \semantex_object_set_keys:Nn ##1 { ##3 } } + { + \use:c { __semantex_define_object_of_\semantex_class_to_register:N #1:N } ##1 + } } - % create the object with name ##1 - \DeclareDocumentCommand{##1}{} + } + \exp_args:Nc\DeclareDocumentCommand{__semantex_declare_object_of_\semantex_class_to_register:N #1:Nw}{mgO{}} + { + % new object of class #1 + % ##1 = object name + % ##2 = symbol + % ##3 = options + \IfValueTF{##2} { - % the actual \##1 command - \semantex_write_original_source_to_semtex_file:n { ##1 } - \semantex_render_object:Nn ##1 { } + \semantex_declare_object_and_do:NNnn #1 ##1 { + \semantex_object_set_symbol:Nn ##1 { ##2 } + \semantex_object_set_keys:Nn ##1 { ##3 } + } + { + \use:c { __semantex_define_object_of_\semantex_class_to_register:N #1:N } ##1 + } + } + { + \semantex_declare_object_and_do:NNnn #1 ##1 { + \semantex_object_set_keys:Nn ##1 { ##3 } + } + { + \use:c { __semantex_define_object_of_\semantex_class_to_register:N #1:N } ##1 + } } } } -\NewDocumentCommand\DeclareSimpleClass{ m O{} } +\NewDocumentCommand\NewSimpleClass { m O{} } { - \semantex_declare_class:Nn { #1 } { \semantex_class_set_keys:Nn #1 { #2 } } - \semantex_declare_simple_class:N #1 + \semantex_new_class_and_do:NNnn #1 \DeclareSimpleClass { \semantex_class_set_keys:Nn #1 { #2 } } + { + \semantex_define_simple_class:N #1 + } } -\NewDocumentCommand\NewSimpleClass { m O{} } +\NewDocumentCommand\DeclareSimpleClass{ m O{} } { - \semantex_new_class_and_do:NNnn #1 \DeclareSimpleClass { \semantex_class_set_keys:Nn #1 { #2 } } + \semantex_declare_class_and_do:Nnn { #1 } { \semantex_class_set_keys:Nn #1 { #2 } } { - \semantex_declare_simple_class:N #1 + \semantex_define_simple_class:N #1 } } -\cs_new_protected:Npn\semantex_declare_symbol_class:N #1 % new symbol-type class +\cs_new_protected:Npn\semantex_define_symbol_class:N #1 % new symbol-type class { % #1 = class name \DeclareDocumentCommand{#1}{mo} @@ -251,59 +286,94 @@ } } } - \exp_args:Nc\DeclareDocumentCommand{__semantex_declare_object_of_\semantex_class_to_register:N #1:Nw}{mgO{}} + \cs_set_protected:cpn { __semantex_define_object_of_\semantex_class_to_register:N #1:N } ##1 { - % the command for creating a new object of class #1 - % ##1 = command name, with backslash + % create the object with name ##1 + \DeclareDocumentCommand{##1}{o} + { + \IfValueTF { ####1 } + { + \semantex_write_original_source_to_semtex_file:n { ##1 [ ####1 ] } + \semantex_render_object:Nn ##1 { + \semantex_object_do_output:N ##1 + \semantex_object_set_keys:Nn ##1 { ####1 } + } + } + { + \semantex_write_original_source_to_semtex_file:n { ##1 } + \semantex_render_object:Nn ##1 { } + } + } + } + \exp_args:Nc\DeclareDocumentCommand{__semantex_new_object_of_\semantex_class_to_register:N #1:Nw}{mgO{}} + { + % new object of class #1 + % ##1 = object name % ##2 = symbol % ##3 = options \IfValueTF{##2} { - \semantex_declare_object:NNn #1 ##1 { + \semantex_new_object_and_do:NNnn #1 ##1 { \semantex_object_set_symbol:Nn ##1 { ##2 } \semantex_object_set_keys:Nn ##1 { ##3 } } + { + \use:c { __semantex_define_object_of_\semantex_class_to_register:N #1:N } ##1 + } } { - \semantex_declare_object:NNn #1 ##1 { + \semantex_new_object:NNnn #1 ##1 { \semantex_object_set_keys:Nn ##1 { ##3 } } + { + \use:c { __semantex_define_object_of_\semantex_class_to_register:N #1:N } ##1 + } } - % create the object with name ##1 - \DeclareDocumentCommand{##1}{o} + } + \exp_args:Nc\DeclareDocumentCommand{__semantex_declare_object_of_\semantex_class_to_register:N #1:Nw}{mgO{}} + { + % declare object of class #1 + % ##1 = object name + % ##2 = symbol + % ##3 = options + \IfValueTF{##2} { - % the actual \##1 command - \IfValueTF { ####1 } + \semantex_declare_object_and_do:NNnn #1 ##1 { + \semantex_object_set_symbol:Nn ##1 { ##2 } + \semantex_object_set_keys:Nn ##1 { ##3 } + } { - \semantex_write_original_source_to_semtex_file:n { ##1 [ ####1 ] } - \semantex_render_object:Nn ##1 { - \semantex_object_do_output:N ##1 - \semantex_object_set_keys:Nn ##1 { ####1 } - } + \use:c { __semantex_define_object_of_\semantex_class_to_register:N #1:N } ##1 + } + } + { + \semantex_declare_object:NNnn #1 ##1 { + \semantex_object_set_keys:Nn ##1 { ##3 } } { - \semantex_write_original_source_to_semtex_file:n { ##1 } - \semantex_render_object:Nn ##1 { } + \use:c { __semantex_define_object_of_\semantex_class_to_register:N #1:N } ##1 } } } } -\NewDocumentCommand\DeclareSymbolClass{ m O{} } +\NewDocumentCommand\NewSymbolClass { m O{} } { - \semantex_declare_class:Nn { #1 } { \semantex_class_set_keys:Nn #1 { #2 } } - \semantex_declare_symbol_class:N #1 + \semantex_new_class_and_do:NNnn #1 \DeclareSymbolClass { \semantex_class_set_keys:Nn #1 { #2 } } + { + \semantex_define_symbol_class:N #1 + } } -\NewDocumentCommand\NewSymbolClass { m O{} } +\NewDocumentCommand\DeclareSymbolClass{ m O{} } { - \semantex_new_class_and_do:NNnn #1 \DeclareSymbolClass { \semantex_class_set_keys:Nn #1 { #2 } } + \semantex_declare_class_and_do:Nnn { #1 } { \semantex_class_set_keys:Nn #1 { #2 } } { - \semantex_declare_symbol_class:N #1 + \semantex_define_symbol_class:N #1 } } -\cs_new_protected:Npn\semantex_declare_variable_class:N#1 % new variable-type class +\cs_new_protected:Npn\semantex_define_variable_class:N#1 % new variable-type class { % #1 = class name \DeclareDocumentCommand{#1}{mog} @@ -392,27 +462,11 @@ } } } - \exp_args:Nc\DeclareDocumentCommand{__semantex_declare_object_of_\semantex_class_to_register:N #1:Nw}{mgO{}} + \cs_set_protected:cpn { __semantex_define_object_of_\semantex_class_to_register:N #1:N } ##1 { - % the command for creating a new object of class #1 - % ##1 = command name, with backslash - % ##2 = symbol - % ##3 = options - \IfValueTF{##2} - { - \semantex_declare_object:NNn #1 ##1 { - \semantex_object_set_symbol:Nn ##1 { ##2 } - \semantex_object_set_keys:Nn ##1 { ##3 } - } - } - { - \semantex_declare_object:NNn #1 ##1 { - \semantex_object_set_keys:Nn ##1 { ##3 } - } - } % creates the object with name ##1 - \DeclareDocumentCommand{##1}{og}{ - % the actual \##1 command + \DeclareDocumentCommand{##1}{og} + { \IfValueTF{####1}{ \IfValueTF{####2} { @@ -459,19 +513,71 @@ } } } + \exp_args:Nc\DeclareDocumentCommand{__semantex_new_object_of_\semantex_class_to_register:N #1:Nw}{mgO{}} + { + % new object of class #1 + % ##1 = object name + % ##2 = symbol + % ##3 = options + \IfValueTF{##2} + { + \semantex_new_object_and_do:NNnn #1 ##1 { + \semantex_object_set_symbol:Nn ##1 { ##2 } + \semantex_object_set_keys:Nn ##1 { ##3 } + } + { + \use:c { __semantex_define_object_of_\semantex_class_to_register:N #1:N } ##1 + } + } + { + \semantex_new_object_and_do:NNnn #1 ##1 { + \semantex_object_set_keys:Nn ##1 { ##3 } + } + { + \use:c { __semantex_define_object_of_\semantex_class_to_register:N #1:N } ##1 + } + } + } + \exp_args:Nc\DeclareDocumentCommand{__semantex_declare_object_of_\semantex_class_to_register:N #1:Nw}{mgO{}} + { + % declare object of class #1 + % ##1 = object name + % ##2 = symbol + % ##3 = options + \IfValueTF{##2} + { + \semantex_declare_object_and_do:NNnn #1 ##1 { + \semantex_object_set_symbol:Nn ##1 { ##2 } + \semantex_object_set_keys:Nn ##1 { ##3 } + } + { + \use:c { __semantex_define_object_of_\semantex_class_to_register:N #1:N } ##1 + } + } + { + \semantex_declare_object_and_do:NNnn #1 ##1 { + \semantex_object_set_keys:Nn ##1 { ##3 } + } + { + \use:c { __semantex_define_object_of_\semantex_class_to_register:N #1:N } ##1 + } + } + } } -\NewDocumentCommand\DeclareVariableClass{ m O{} } +\NewDocumentCommand\NewVariableClass { m O{} } { - \semantex_declare_class:Nn { #1 } { \semantex_class_set_keys:Nn #1 { #2 } } - \semantex_declare_variable_class:N #1 + \semantex_new_class_and_do:NNnn #1 \DeclareVariableClass { \semantex_class_set_keys:Nn #1 { #2 } } + { + \semantex_define_variable_class:N #1 + } } -\NewDocumentCommand\NewVariableClass { m O{} } +\NewDocumentCommand\DeclareVariableClass{ m O{} } { - \semantex_new_class_and_do:NNnn #1 \DeclareVariableClass { \semantex_class_set_keys:Nn #1 { #2 } } + \semantex_declare_class_and_do:Nnn { #1 } { \semantex_class_set_keys:Nn #1 { #2 } } { - \semantex_declare_variable_class:N #1 + \semantex_define_variable_class:N #1 } } @@ -511,31 +617,36 @@ \tl_set:Nx \g_semantex_class_SemantexBaseObject_register_tl { \semantex_class_to_register:N \SemantexBaseObject } -\DeclareDocumentCommand\DeclareObject { m m } +\DeclareDocumentCommand\NewObject { m m } { - % #1 = name of object + % #1 = name of class + % #2 = name of object \semantex_class_if_exist:NTF #1 { - \use:c { __semantex_declare_object_of_\semantex_class_to_register:N #1:Nw } #2 + \use:c { __semantex_new_object_of_\semantex_class_to_register:N #1:Nw } #2 } { - \msg_error:nnn { semantex } { created_object_of_unknown_class } { #1 } + \msg_error:nnxx { semantex } { created_object_of_unknown_class } { \token_to_str:N #1 } { \token_to_str:N #2 } } } -\DeclareDocumentCommand\NewObject { m m } +\DeclareDocumentCommand\DeclareObject { m m } { - \cs_if_exist:NTF #2 + % #1 = name of class + % #2 = name of object + \semantex_class_if_exist:NTF #1 { - \msg_error:nnn { semantex } { created_object_with_already_defined_name } { #2 } + \use:c { __semantex_declare_object_of_\semantex_class_to_register:N #1:Nw } #2 } { - \DeclareObject #1 #2 + \msg_error:nnxx { semantex } { created_object_of_unknown_class } { \token_to_str:N #1 } { \token_to_str:N #2 } } } \DeclareDocumentCommand\UseClassInCommand { mo } { + % #1 = name of class + % #2 = options to pass to class \semantex_class_if_exist:NTF #1 { \IfValueTF { #2 } @@ -550,7 +661,7 @@ } } { - \msg_error:nnn { semantex } { used_unknown_class } { #1 } + \msg_error:nnx { semantex } { used_unknown_class } { \token_to_str:N #1 } } } @@ -595,14 +706,31 @@ \cs_generate_variant:Nn \semantex_new_register:nn { xn } -\cs_new_protected:Npn \semantex_declare_class:Nn#1#2 +\cs_new_protected:Npn \semantex_new_class_and_do:NNnn#1#2#3#4 +{ + % create a new class + % #1 = name of class + % #2 = name of \Declare...Class variant of command, for error messages + % #3 = standard keyval setup + % #4 = code to execute if successful + \cs_if_exist:NTF #1 + { + \msg_error:nnxx { semantex } { created_class_with_already_defined_name } { \token_to_str:N #1 } { \token_to_str:N #2 } + } + { + \semantex_declare_class_and_do:Nnn #1 { #3 } { #4 } + } +} + +\cs_new_protected:Npn \semantex_declare_class_and_do:Nnn#1#2#3 { % create a new class % #1 = name of class % #2 = standard keyval setup + % #3 = code to execute if succesful \semantex_class_if_exist:NTF #1 { - \msg_error:nnn { semantex } { class_already_defined } { #1 } + \msg_error:nnx { semantex } { class_already_defined } { \token_to_str:N #1 } } { \semantex_add_to_list_of_classes:N #1 @@ -610,35 +738,36 @@ \semantex_new_register:xn { \semantex_class_to_associated_object_register:N #1 } { \semantex_object_associated_to_class_set_class:Nn #1 { #1 } } + #3 } } -\cs_new_protected:Npn \semantex_new_class_and_do:NNnn#1#2#3#4 +\cs_set_protected:Npn \semantex_new_object_and_do:NNnn#1#2#3#4 { - % create a new class + % create a new object % #1 = name of class - % #2 = name of \Declare...Class variant of command, for error messages + % #2 = name of object % #3 = standard keyval setup % #4 = code to execute if successful - \cs_if_exist:NTF #1 + \cs_if_exist:NTF #2 { - \msg_error:nnnn { semantex } { created_class_with_already_defined_name } { #1 } { #2 } + \msg_error:nnx { semantex } { created_object_with_already_defined_name } { \token_to_str:N #2 } } { - \semantex_declare_class:Nn #1 { #3 } - #4 + \semantex_declare_object_and_do:NNnn #1 #2 { #3 } { #4 } } } -\cs_set_protected:Npn \semantex_declare_object:NNn#1#2#3 +\cs_set_protected:Npn \semantex_declare_object_and_do:NNnn#1#2#3#4 { % create a new object % #1 = name of class % #2 = name of object % #3 = standard keyval setup + % #4 = code to execute if successful \semantex_object_if_exist:NTF #2 { - \msg_error:nnn { semantex } { object_already_defined } { #2 } + \msg_error:nnx { semantex } { object_already_defined } { \token_to_str:N #2 } } { \semantex_add_to_list_of_objects:N #2 @@ -647,6 +776,7 @@ \semantex_object_set_class:Nn #2 { #1 } #3 } + #4 } } @@ -1623,7 +1753,7 @@ \tl_set:cx { g__semantex_data_tl_#1_parent } { \semantex_class_to_register:N #2 } } { - \semantex_msg_error:nnnn { #1 } { class_not_found } { parent } { #2 } + \semantex_msg_error:nnnx { #1 } { class_not_found } { parent } { \token_to_str:N #2 } } } @@ -1636,7 +1766,7 @@ \tl_set:cx { g__semantex_data_tl_#1_parent } { \semantex_class_to_register:N #2 } } { - \semantex_msg_error:nnnn { #1 } { class_not_found } { class } { #2 } + \semantex_msg_error:nnnx { #1 } { class_not_found } { class } { \token_to_str:N #2 } } } @@ -1649,7 +1779,7 @@ \tl_set:cx { g__semantex_data_tl_#1_parent } { \semantex_object_to_register:N #2 } } { - \semantex_msg_error:nnnn { #1 } { object_not_found } { copy } { #2 } + \semantex_msg_error:nnnx { #1 } { object_not_found } { copy } { \token_to_str:N #2 } } } @@ -6004,7 +6134,7 @@ \semantex_data_tl_set:nnx { #1 } { output } { \semantex_class_to_register:N #2 } } { - \semantex_msg_error:nnnn { #1 } { class_not_found } { output } { #2 } + \semantex_msg_error:nnnx { #1 } { class_not_found } { output } { \token_to_str:N #2 } } } @@ -6273,11 +6403,11 @@ %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -\msg_new:nnnn { semantex } { semantex_setup_key_not_found } { Unknown~key~#1~passed~to~\token_to_str:N\SemantexSetup~on~line~\msg_line_number: } {} +\msg_new:nnnn { semantex } { semantex_setup_key_not_found } { Unknown~key~#1~passed~to~\token_to_str:N\SemantexSetup\ on~line~\msg_line_number: } {} -\msg_new:nnnn { semantex } { semantex_setup_key_value_not_found } { Unknown~value~#2~passed~to~key~#1~in~\token_to_str:N\SemantexSetup~on~line~\msg_line_number: } {} +\msg_new:nnnn { semantex } { semantex_setup_key_value_not_found } { Unknown~value~#2~passed~to~key~#1~in~\token_to_str:N\SemantexSetup\ on~line~\msg_line_number: } {} -\msg_new:nnnn { semantex } { valuekey_not_found } { Unknown~key~#2~passed~to~#1~on~line~\msg_line_number: } {} +\msg_new:nnnn { semantex } { valuekey_not_found } { Unknown~key~#2~passed~to~#1~on~line~\msg_line_number: } {} \msg_new:nnnn { semantex } { arg_valuekey_not_found } { Unknown~argument~key~#2~passed~to~#1~on~line~\msg_line_number: } {} @@ -6303,21 +6433,21 @@ \msg_new:nnnn { semantex } { object_not_found } { You~set~#1~as~#2~of~unknown~object~#3~on~line~\msg_line_number: } {} -\msg_new:nnnn { semantex } { created_object_of_unknown_class } { Unknown~class~#1~declared~as~class~of~#2~on~line~\msg_line_number: } {} +\msg_new:nnnn { semantex } { created_object_of_unknown_class } { Unknown~class~#1~declared~as~class~of~object~#2~on~line~\msg_line_number: } {} -\msg_new:nnnn { semantex } { created_object_with_already_defined_name } { Command~#1~already~defined;~you~can~use~\token_to_str:N\DeclareObject~to~override~existing~commands. } {} +\msg_new:nnnn { semantex } { created_object_with_already_defined_name } { Command~#1~already~defined;~you~can~use~\token_to_str:N\DeclareObject\ to~override~existing~commands. } {} -\msg_new:nnnn { semantex } { created_class_with_already_defined_name } { Command~#1~already~defined;~you~can~use~\token_to_str:N #2~to~override~existing~commands. } {} +\msg_new:nnnn { semantex } { created_class_with_already_defined_name } { Command~#1~already~defined;~you~can~use~#2~to~override~existing~commands. } {} -\msg_new:nnnn { semantex } { used_unknown_class } { Unknown~class~#1~received~by~\token_to_str:N\UseClassInCommand~on~line~\msg_line_number: } {} +\msg_new:nnnn { semantex } { used_unknown_class } { Unknown~class~#1~received~by~\token_to_str:N\UseClassInCommand\ on~line~\msg_line_number: } {} \msg_new:nnnn { semantex } { setup_unknown_class } { You~tried~setting~up~an~unknown~#1~on~line~\msg_line_number: } {} \msg_new:nnnn { semantex } { setup_unknown_object } { You~tried~setting~up~an~unknown~#1~on~line~\msg_line_number: } {} -\msg_new:nnnn { semantex } { created_a_SemantexBaseObject } { Never~create~objects~of~class~\token_to_str:N\SemantexBaseObject;~create~a~new~class~yourself~instead.~You~created~the~object~#1 on~line~\msg_line_number: } {} +\msg_new:nnnn { semantex } { created_a_SemantexBaseObject } { Never~create~objects~of~class~\token_to_str:N\SemantexBaseObject;~create~a~new~class~yourself~instead.~You~created~the~object~#1~on~line~\msg_line_number: } {} -\msg_new:nnnn { semantex } { SemantexThis_in_input_stream } { The~command~\token_to_str:N\SemantexThis~was~found~outside~a~class~or~object~on~line~\msg_line_number:;~did~you~forget~to~use~set~keys~x={...}? } {} +\msg_new:nnnn { semantex } { SemantexThis_in_input_stream } { The~command~\token_to_str:N\SemantexThis\ was~found~outside~a~class~or~object~on~line~\msg_line_number:;~did~you~forget~to~use~set~keys~x={...}? } {} \msg_new:nnnn { semantex } { generic_error } { #2~#1~on~line~\msg_line_number: } {} @@ -6352,6 +6482,8 @@ } } +\cs_generate_variant:Nn \semantex_msg_error:nn { xn } + \cs_new_protected:Npn \semantex_msg_error:nnn#1#2#3 { \semantex_error_output_format:xN { #1 } \l__semantex_msg_error_nnnn_temp_tl @@ -6361,7 +6493,7 @@ } { #3 } } -\cs_generate_variant:Nn \semantex_msg_error:nnn { nnx } +\cs_generate_variant:Nn \semantex_msg_error:nnn { nnx, xnx } \cs_new_protected:Npn \semantex_msg_error:nnnn#1#2#3#4 { @@ -6372,6 +6504,8 @@ } { #3 } { #4 } } +\cs_generate_variant:Nn \semantex_msg_error:nnnn { xnxx, xnnx, nnnx , nnxx } + \cs_new_protected:Npn\semantex_error_key_value_not_found:nnn#1#2#3 { \semantex_msg_error:nnnn { #1 } { key_value_not_found } { #2 } { #3 } @@ -8683,12 +8817,19 @@ \cs_set_eq:cc { __semantex_old_version_of_semantex_declare_object_of_\g_semantex_class_SemantexBaseObject_register_tl :Nw } { __semantex_declare_object_of_\g_semantex_class_SemantexBaseObject_register_tl :Nw } -\cs_set_protected:Npn \__semantex_declare_object_of_class_SemantexBaseObject:Nw#1 +\cs_set_protected:cpn { __semantex_declare_object_of_\g_semantex_class_SemantexBaseObject_register_tl :Nw } #1 { - \msg_error:nnn { semantex } { created_a_SemantexBaseObject } { #1 } + \msg_error:nnx { semantex } { created_a_SemantexBaseObject } { \token_to_str:N #1 } \use:c { __semantex_old_version_of_semantex_declare_object_of_\g_semantex_class_SemantexBaseObject_register_tl :Nw } #1 } +\cs_set_eq:cc { __semantex_old_version_of_semantex_new_object_of_\g_semantex_class_SemantexBaseObject_register_tl :Nw } { __semantex_new_object_of_\g_semantex_class_SemantexBaseObject_register_tl :Nw } + +\cs_set_protected:cpn { __semantex_new_object_of_\g_semantex_class_SemantexBaseObject_register_tl :Nw } #1 +{ + \msg_error:nnx { semantex } { created_a_SemantexBaseObject } { \token_to_str:N #1 } + \use:c { __semantex_old_version_of_semantex_new_object_of_\g_semantex_class_SemantexBaseObject_register_tl :Nw } #1 +} %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % diff --git a/macros/latex/contrib/semantex/semantex.tex b/macros/latex/contrib/semantex/semantex.tex index a377e0f217..bd932ca3be 100644 --- a/macros/latex/contrib/semantex/semantex.tex +++ b/macros/latex/contrib/semantex/semantex.tex @@ -5749,19 +5749,35 @@ In other words, it determines which arguments an object of that class can take. The syntax for creating new objects also varies. +Each class has a \lstinline!\New...! as well as a \lstinline!\Declare...! variant, the difference being +that the \lstinline!\New...! variant raises an error if the command name is already taken. +Both variants will raise an error if a \semantex{} class with the same name already exists. +Allowing you to override existing \semantex{} definitions would require fundamental changes +to the system which would slow it down significantly. + +Similarly, you can use both of the commands \lstinline!\NewObject! and \lstinline!\DeclareObject! +to define objects, the difference being that \lstinline!\NewObject! raises an error +if the command name is already taken. +Both commands will raise an error if a \semantex{} object with the same name already exists. +Allowing you to override existing \semantex{} definitions would require fundamental changes +to the system which would slow it down significantly. + + The current implementation has the following class types: \begin{itemize} \item \lstinline!Variable!: - A new class is declared with the + A new class is defined with the syntax \begin{lstlisting} \NewVariableClass{@\usercommand\@}[@\@] + \DeclareVariableClass{@\usercommand\@}[@\@] \end{lstlisting} A new object is declared by \begin{lstlisting} \NewObject@\usercommand\@@\usercommand\@{@\@}[@\@] + \DeclareObject@\usercommand\@@\usercommand\@{@\@}[@\@] \end{lstlisting} The syntax for this object is \begin{lstlisting} @@ -5771,11 +5787,13 @@ class types: A new class is declared with the syntax \begin{lstlisting} - \NewSimpleClass@\usercommand\@[@\@] + \NewSymbolClass@\usercommand\@[@\@] + \DeclareSymbolClass@\usercommand\@[@\@] \end{lstlisting} A new object is declared by \begin{lstlisting} \NewObject@\usercommand\@@\usercommand\@{@\@}[@\@] + \DeclareObject@\usercommand\@@\usercommand\@{@\@}[@\@] \end{lstlisting} The syntax for this object is \begin{lstlisting} @@ -5786,10 +5804,12 @@ class types: syntax \begin{lstlisting} \NewSimpleClass@\usercommand\@[@\@] + \DeclareSimpleClass@\usercommand\@[@\@] \end{lstlisting} A new object is declared by \begin{lstlisting} \NewObject@\usercommand\@@\usercommand\@{@\@}[@\@] + \DeclareObject@\usercommand\@@\usercommand\@{@\@}[@\@] \end{lstlisting} The syntax for this object is \begin{lstlisting} diff --git a/macros/latex/contrib/semantex/stripsemantex.sty b/macros/latex/contrib/semantex/stripsemantex.sty index 1dd814689c..cdd6947469 100644 --- a/macros/latex/contrib/semantex/stripsemantex.sty +++ b/macros/latex/contrib/semantex/stripsemantex.sty @@ -1,5 +1,5 @@ \RequirePackage{xparse} -\ProvidesExplPackage{stripsemantex}{2022/09/22}{0.530}{} +\ProvidesExplPackage{stripsemantex}{2022/09/24}{0.521}{} %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % % diff --git a/macros/latex/contrib/wargame/README.md b/macros/latex/contrib/wargame/README.md index e5fd92458c..a66da25247 100644 --- a/macros/latex/contrib/wargame/README.md +++ b/macros/latex/contrib/wargame/README.md @@ -1,42 +1,48 @@ # A package to make Hex'n'Counter wargames in LaTeX -## Version 0.2 -This package can help make classic [Hex'n'Counter wargames][1] using -LaTeX. The package provide tools for generating +## Version 0.2.1 -- Hex maps and boards -- Counters (called _chits_ since TeX have already taken _counters_) - for units, markers, and so on -- Counter sheets -- Order of Battle charts -- Illustrations in the rules using the defined maps and counters +This package can help make classic [Hex'n'Counter +wargames](https://en.wikipedia.org/wiki/Wargame) using LaTeX. The +package provide tools for generating -The result will often be a PDF (or set of PDFs) that contain -everything one will need for a game (rules, charts, boards, counter -sheets). +- Hex maps and boards +- Counters (called *chits* since TeX have already taken *counters*) + for units, markers, and so on +- Counter sheets +- Order of Battle charts +- Illustrations in the rules using the defined maps and counters -- The package uses [NATO App6](#NATO-App6) symbology for units. -- The package uses [TikZ][2] for most things. -- The package support exporting the game to a - [VASSAL](#VASSAL-support) module +The result will often be a PDF (or set of PDFs) that contain everything +one will need for a game (rules, charts, boards, counter sheets). -## Sources +- The package uses [NATO App6](#nato-app6 "Section below") symbology + for units. +- The package uses [TikZ](https://github.com/pgf-tikz/pgf) for most + things. +- The package support exporting the game to a + [VASSAL](#vassal-support%20'Section%20below') module -The sources of the package are kept at [GitLab][3] +## Sources -## CTAN +The sources of the package are kept at +[GitLab](https://gitlab.com/wargames_tex/wargame_tex) -The package is available from [CTAN][4] in the directory -`/macros/latex/contrib/wargame`. As of this writing, the package has -not hit any of the major distributions (e.g., [TeXLive][5]). +## CTAN -If you get the sources (`wargame.ins`, all `.dtx` and `.py`) files, -then to install do +The package is available from +[CTAN](https://ctan.org/tex-archive/macros/latex/contrib/wargame) in the +directory `/macros/latex/contrib/wargame`. As of this writing, the +package has not hit any of the major distributions (e.g., +[TeXLive](https://tug.org/texlive/index.html)). - latex wargame.ins +If you get the sources (`wargame.ins`, all `.dtx` and `.py`) files, then +to install do + + latex wargame.ins pdflatex beach pdflatex city - pdflatex light_woods + pdflatex light_woods pdflatex mountains pdflatex rough pdflatex swamp @@ -47,224 +53,213 @@ then to install do (You need to use `pdflatex`, `xelatex`, or `lualatex` - plain `latex` with DVI output will not work) -Then copy the relevant files to your TeX tree (e.g., `~/texmf/`) -as +Then copy the relevant files to your TeX tree (e.g., `~/texmf/`) as mkdir ~/texmf/tex/latex/wargame - cp tikzlibrary*.tex ~/texmf/tex/latex/wargame/ - cp wargame.sty ~/texmf/tex/latex/wargame/ - cp wgexpor.sty ~/texmf/tex/latex/wargame/ + cp tikzlibrary*.tex ~/texmf/tex/latex/wargame/ + cp wargame.sty ~/texmf/tex/latex/wargame/ + cp wgexpor.sty ~/texmf/tex/latex/wargame/ cp city.pdf ~/texmf/tex/latex/wargame/ - cp light_woods.pdf ~/texmf/tex/latex/wargame/ + cp light_woods.pdf ~/texmf/tex/latex/wargame/ cp mountains.pdf ~/texmf/tex/latex/wargame/ cp rough.pdf ~/texmf/tex/latex/wargame/ cp swamp.pdf ~/texmf/tex/latex/wargame/ cp town.pdf ~/texmf/tex/latex/wargame/ cp village.pdf ~/texmf/tex/latex/wargame/ cp woods.pdf ~/texmf/tex/latex/wargame/ - cp export.py ~/texmf/tex/latex/wargame/ - cp svg2tikz.py ~/texmf/tex/latex/wargame/ - -To generate the documentation, after having done the above, do - - pdflatex wargame.dtx - makeindex -s gind -o wargame.ind wargame.idx - pdflatex wargame.dtx - pdflatex wargame.dtx - pdflatex symbols.tex - pdflatex compat.tex - pdflatex compat.tex - + cp export.py ~/texmf/tex/latex/wargame/ + cp svg2tikz.py ~/texmf/tex/latex/wargame/ + +To generate the documentation, after having done the above, do + + pdflatex wargame.dtx + makeindex -s gind -o wargame.ind wargame.idx + pdflatex wargame.dtx + pdflatex wargame.dtx + pdflatex symbols.tex + pdflatex compat.tex + pdflatex compat.tex + (You need to use `pdflatex`, `xelatex`, or `lualatex` - plain `latex` with DVI output will not work) -You can install these into your TeX tree with (e.g., `~/texmf/`) +You can install these into your TeX tree with (e.g., `~/texmf/`) - mkdir -p ~/texmf/doc/latex/wargame/ + mkdir -p ~/texmf/doc/latex/wargame/ cp wargame.pdf ~/texmf/doc/latex/wargame/ - cp symbols.py ~/texmf/doc/latex/wargame/ - cp compat.py ~/texmf/doc/latex/wargame/ - -If you want to generate the tutorial document, do - - cd tutorial - pdflatex game - pdflatex game - + cp symbols.py ~/texmf/doc/latex/wargame/ + cp compat.py ~/texmf/doc/latex/wargame/ + +If you want to generate the tutorial document, do + + cd tutorial + pdflatex game + pdflatex game + If you also want to make the tutorial VASSAL module, do (also in -`tutorial`), do - - pdflatex export.tex - ../export.py export.pdf export.json -o Game.vmod \ - -d "Example module from LaTeX PnP game" \ - -t "LaTeX wargame tutorial" -v 0.1 \ - -p patch.py - - - - -## Download from GitLab - -- [Zip file of package and support files][artifacts.zip] -- [Browse content of package][browse] -- [Documentation][wargame.pdf] -- [Tutorial][tutorial.pdf] (and associated VASSAL [module][Game.vmod]) -- [Table of symbols][symbols.pdf] -- [Compatibility][compat.pdf] - -To install, get the ([zip file][artifacts.zip]) and unzip into your -TeX tree, for example - - mkdir -p ~/texmf - (cd ~/texmf && unzip ../artifacts.zip) - -on Un*x like systems. - -## Tutorial - -See the [tutorial](tutorial/README.md) page for more. - -## Examples - -Below are some print'n'play board wargames made with this package. -These are not original games but rather revamps of existing games. -All credits goes to the original authors of these games. - -- WWII - - Eastern Front - - [Battle for Moscow][bfm_tex] - - [Hell's Gate][hellsgate_tex] (private) - - [Unternehmung 25][unternehmung_tex] (private) - - Western Front - - [D-Day][dday_tex] (Avalon Hill classic) - - [Paul Koenig's Market Garden][pkmg_tex] - - [Paul Koenig's D-Day][pkdday_tex] - - Pacific theatre - - [First Blood][firstblood_tex] (Avalon Hill International - Kriegspiel Association classic) - - [Malaya][malaya_tex] (private) - - Africa - - [Afrika Korps][afrikakorps_tex] (Avalon Hill classic) - - [Battles of El Alamein][boel_tex] (private) -- Modern/Speculative - - [Strike Force One][sfo_tex] - - [Kriegspiel][kriegspiel_tex] (Avalon Hill classic) +`tutorial`), do + + pdflatex export.tex + ../export.py export.pdf export.json -o Game.vmod \ + -d "Example module from LaTeX PnP game" \ + -t "LaTeX wargame tutorial" -v 0.1 \ + -p patch.py + +## Download from GitLab + +- [Zip file of package and support + files](https://gitlab.com/wargames_tex/wargame_tex/-/jobs/artifacts/master/download?job=dist) +- [Browse content of + package](https://gitlab.com/wargames_tex/wargame_tex/-/jobs/artifacts/master/browse?job=dist) +- [Documentation](https://gitlab.com/wargames_tex/wargame_tex/-/jobs/artifacts/master/file/public/doc/latex/wargame/wargame.pdf?job=dist) +- [Tutorial](https://gitlab.com/wargames_tex/wargame_tex/-/jobs/artifacts/master/file/public/doc/latex/wargame/tutorial.pdf?job=dist) + (and associated VASSAL + [module](https://gitlab.com/wargames_tex/wargame_tex/-/jobs/artifacts/master/file/public/doc/latex/wargame/Game.vmod?job=dist)) +- [Table of + symbols](https://gitlab.com/wargames_tex/wargame_tex/-/jobs/artifacts/master/file/public/doc/latex/wargame/symbols.pdf?job=dist) +- [Compatibility](https://gitlab.com/wargames_tex/wargame_tex/-/jobs/artifacts/master/file/public/doc/latex/wargame/compat.pdf?job=dist) + +To install, get the ([zip +file](https://gitlab.com/wargames_tex/wargame_tex/-/jobs/artifacts/master/download?job=dist)) +and unzip into your TeX tree, for example + + mkdir -p ~/texmf + (cd ~/texmf && unzip ../artifacts.zip) + +on Un\*x like systems. + +## Tutorial + +See the [tutorial](tutorial/README.md "Link works on GitLab only") page +for more +([here](https://ctan.org/tex-archive/macros/latex/contrib/wargame/doc/tutorial/) +if you browse from CTAN). + +## Examples + +Below are some print'n'play board wargames made with this package. These +are not original games but rather revamps of existing games. All credits +goes to the original authors of these games. + +- WWII + - Eastern Front + - [Battle for Moscow](https://gitlab.com/wargames_tex/bfm_tex) + - [Hell's Gate](https://gitlab.com/wargames_tex/hellsgate_tex) + (private) + - [Unternehmung + 25](https://gitlab.com/wargames_tex/unternehmung_tex) + (private) + - Western Front + - [D-Day](https://gitlab.com/wargames_tex/dday_tex) (Avalon + Hill classic) + - [Paul Koenig's Market + Garden](https://gitlab.com/wargames_tex/pkmg_tex) + - [Paul Koenig's + D-Day](https://gitlab.com/wargames_tex/pkdday_tex) + - Pacific theatre + - [First + Blood](https://gitlab.com/wargames_tex/firstblood_tex) + (Avalon Hill International Kriegspiel Association classic) + - [Malaya](https://gitlab.com/wargames_tex/malaya_tex) + (private) + - Africa + - [Afrika + Korps](https://gitlab.com/wargames_tex/afrikakorps_tex) + (Avalon Hill classic) + - [Battles of El + Alamein](https://gitlab.com/wargames_tex/boel_tex) (private) +- Modern/Speculative + - [Strike Force One](https://gitlab.com/wargames_tex/sfo_tex) + - [Kriegspiel](https://gitlab.com/wargames_tex/kriegspiel_tex) + (Avalon Hill classic) ## VASSAL support -The packages has the script [`export.py`](utils/export.py) to -generate a draft [VASSAL][5] module from the defined charts, boards, -counters, OOBs, and so on. More about this is given in the -documentation. +The packages has the script [`export.py`](utils/export.py) to generate a +draft [VASSAL](https://vassalengine.org) module from the defined charts, +boards, counters, OOBs, and so on. More about this is given in the +documentation. The script will generate a first draft of a module, which then can be -edited in the VASSAL editor for the final thing. +edited in the VASSAL editor for the final thing. Alternatively, one can provide a Python script to do more on the generated module, such as defining starting positions, fixing grid -layouts, and so on. Using such a patch script, one can get an -(almost) final module. This means, that even if one makes changes to -the original content, it is easy to remake the module without much -need for the VASSAL editor. - -An example of this is given in the [Battle for Moscow][bfm_tex] -project, and of course in the [tutorial](tutorial/) - -## NATO App6 - -The package supports - -- All air, equipment, installation, land, sea surface, sub surface, - and space command symbols, including amplifiers and modifiers -- All friendly, hostile, neutral, and unknown faction frame. - Undecided faction frames can be made by specifying `dashed` line - styles. -- Some, but very few, other kinds of symbology. - -Here are some references for more information on the NATO App6 -symbology standard. - -- The [Wikipedia page][6] on NATO Joint Military Symbology -- The [NATO page][7]. If this does not work for you, then try to go - to the [standards page][8] and put in and write in `SYMBOLOGY` in - the _Document Title Contains Words_ field and press _Start_. -- Other LaTeX package for making NATO symbology [XMilSymb][9] +layouts, and so on. Using such a patch script, one can get an (almost) +final module. This means, that even if one makes changes to the original +content, it is easy to remake the module without much need for the +VASSAL editor. + +An example of this is given in the [Battle for +Moscow](https://gitlab.com/wargames_tex/bfm_tex) project, and of course +in the [tutorial](tutorial/ "Link works on GitLab only") + +## NATO App6 + +The package supports + +- All air, equipment, installation, land, sea surface, sub surface, + and space command symbols, including amplifiers and modifiers +- All friendly, hostile, neutral, and unknown faction frame. Undecided + faction frames can be made by specifying `dashed` line styles. +- Some, but very few, other kinds of symbology. + +Here are some references for more information on the NATO App6 symbology +standard. + +- The [Wikipedia + page](https://en.wikipedia.org/wiki/NATO_Joint_Military_Symbology) + on NATO Joint Military Symbology +- The [NATO + page](https://nso.nato.int/nso/nsdd/main/standards/ap-details/1912/EN). + If this does not work for you, then try to go to the [standards + page](https://nso.nato.int/nso/nsdd/main/standards) and put in and + write in `SYMBOLOGY` in the *Document Title Contains Words* field + and press *Start*. +- Other LaTeX package for making NATO symbology + [XMilSymb](https://github.com/ralphieraccoon/MilSymb) ## Copyright and license -(c) 2022 Christian Holm Christensen +(c) 2022 Christian Holm Christensen -This work is licensed under the Creative Commons -Attribution-ShareAlike 4.0 International License (CC-BY-SA-4.0). To -view a copy of this license, visit [CC][10] or send a letter to -Creative Commons, PO Box 1866, Mountain View, CA 94042, USA. +This work is licensed under the Creative Commons Attribution-ShareAlike +4.0 International License (CC-BY-SA-4.0). To view a copy of this +license, visit [CC](http://creativecommons.org/licenses/by-sa/4.0/) or +send a letter to Creative Commons, PO Box 1866, Mountain View, CA 94042, +USA. -### Some comments on copyright +### Some comments on copyright -_Caveat_: I am not a lawyer. +*Caveat*: I am not a lawyer. -Note that this license applies to the `wargame` package as such. What -you generate using the package is _not_ required to be licensed -according to the _ShareAlike_ clause of CC-BY-SA-4.0. That is, you -can license your materials _any way you want_. +Note that this license applies to the `wargame` package as such. What +you generate using the package is *not* required to be licensed +according to the *ShareAlike* clause of CC-BY-SA-4.0. That is, you can +license your materials *any way you want*. -However, that copyright rights on games is not as prohibitive as you -may think (see [this thread on BGG][11]). What you _can_ copyright is -original, artistic expression. That is, the copyrighted work must not -be a copy of something else (originality) and must be some form of -expression. One _cannot_ copyright ideas, only their expression in so -far as it is _artistic_ (i.e., not a trivial expression that anyone -knowledgeable within the field can do with rudimentary effort). +However, that copyright rights on games is not as prohibitive as you may +think (see [this thread on +BGG](https://boardgamegeek.com/thread/493249/)). What you *can* +copyright is original, artistic expression. That is, the copyrighted +work must not be a copy of something else (originality) and must be some +form of expression. One *cannot* copyright ideas, only their expression +in so far as it is *artistic* (i.e., not a trivial expression that +anyone knowledgeable within the field can do with rudimentary effort). -So you _can not_ copyright your game mechanics, for example, only how -you described them. You _can not_ copyright a title (but you may be -able to claim trademark on it). You _can_ copyright the wording of -the rules, the graphics that you use, and so on. +So you *can not* copyright your game mechanics, for example, only how +you described them. You *can not* copyright a title (but you may be able +to claim trademark on it). You *can* copyright the wording of the rules, +the graphics that you use, and so on. -This also means, that you are essentially free to make your own -version of previously published game, _as long as_ +This also means, that you are essentially free to make your own version +of previously published game, *as long as* -- you do not copy existing text -- you do not copy existing graphics -- you respect any kind of trademark claims +- you do not copy existing text +- you do not copy existing graphics +- you respect any kind of trademark claims However, it is advisable to contact the copyright holders of the -previously published game to avoid [SNAFU][12]. If in doubt, seek -professional help. - -[1]: https://en.wikipedia.org/wiki/Wargame -[2]: https://github.com/pgf-tikz/pgf -[3]: https://gitlab.com/wargames_tex/wargame_tex -[4]: https://ctan.org/tex-archive/macros/latex/contrib/wargame -[5]: https://tug.org/texlive/index.html -[6]: https://vassalengine.org -[7]: https://en.wikipedia.org/wiki/NATO_Joint_Military_Symbology -[8]: https://nso.nato.int/nso/nsdd/main/standards/ap-details/1912/EN -[9]: https://nso.nato.int/nso/nsdd/main/standards -[10]: https://github.com/ralphieraccoon/MilSymb -[11]: http://creativecommons.org/licenses/by-sa/4.0/ -[12]: https://boardgamegeek.com/thread/493249/ -[13]: https://en.wikipedia.org/wiki/SNAFU - - -[artifacts.zip]: https://gitlab.com/wargames_tex/wargame_tex/-/jobs/artifacts/master/download?job=dist -[browse]: https://gitlab.com/wargames_tex/wargame_tex/-/jobs/artifacts/master/browse?job=dist -[wargame.pdf]: https://gitlab.com/wargames_tex/wargame_tex/-/jobs/artifacts/master/file/public/doc/latex/wargame/wargame.pdf?job=dist -[tutorial.pdf]: https://gitlab.com/wargames_tex/wargame_tex/-/jobs/artifacts/master/file/public/doc/latex/wargame/tutorial.pdf?job=dist -[Game.vmod]: https://gitlab.com/wargames_tex/wargame_tex/-/jobs/artifacts/master/file/public/doc/latex/wargame/Game.vmod?job=dist -[symbols.pdf]: https://gitlab.com/wargames_tex/wargame_tex/-/jobs/artifacts/master/file/public/doc/latex/wargame/symbols.pdf?job=dist -[compat.pdf]: https://gitlab.com/wargames_tex/wargame_tex/-/jobs/artifacts/master/file/public/doc/latex/wargame/compat.pdf?job=dist - -[bfm_tex]: https://gitlab.com/wargames_tex/bfm_tex -[hellsgate_tex]: https://gitlab.com/wargames_tex/hellsgate_tex -[unternehmung_tex]: https://gitlab.com/wargames_tex/unternehmung_tex -[dday_tex]: https://gitlab.com/wargames_tex/dday_tex -[pkmg_tex]: https://gitlab.com/wargames_tex/pkmg_tex -[pkdday_tex]: https://gitlab.com/wargames_tex/pkdday_tex -[firstblood_tex]: https://gitlab.com/wargames_tex/firstblood_tex -[malaya_tex]: https://gitlab.com/wargames_tex/malaya_tex -[afrikakorps_tex]: https://gitlab.com/wargames_tex/afrikakorps_tex -[boel_tex]: https://gitlab.com/wargames_tex/boel_tex -[sfo_tex]: https://gitlab.com/wargames_tex/sfo_tex -[kriegspiel_tex]: https://gitlab.com/wargames_tex/kriegspiel_tex - +previously published game to avoid +[SNAFU](https://en.wikipedia.org/wiki/SNAFU). If in doubt, seek +professional help. diff --git a/macros/latex/contrib/wargame/doc/README.md b/macros/latex/contrib/wargame/doc/README.md index e5fd92458c..a66da25247 100644 --- a/macros/latex/contrib/wargame/doc/README.md +++ b/macros/latex/contrib/wargame/doc/README.md @@ -1,42 +1,48 @@ # A package to make Hex'n'Counter wargames in LaTeX -## Version 0.2 -This package can help make classic [Hex'n'Counter wargames][1] using -LaTeX. The package provide tools for generating +## Version 0.2.1 -- Hex maps and boards -- Counters (called _chits_ since TeX have already taken _counters_) - for units, markers, and so on -- Counter sheets -- Order of Battle charts -- Illustrations in the rules using the defined maps and counters +This package can help make classic [Hex'n'Counter +wargames](https://en.wikipedia.org/wiki/Wargame) using LaTeX. The +package provide tools for generating -The result will often be a PDF (or set of PDFs) that contain -everything one will need for a game (rules, charts, boards, counter -sheets). +- Hex maps and boards +- Counters (called *chits* since TeX have already taken *counters*) + for units, markers, and so on +- Counter sheets +- Order of Battle charts +- Illustrations in the rules using the defined maps and counters -- The package uses [NATO App6](#NATO-App6) symbology for units. -- The package uses [TikZ][2] for most things. -- The package support exporting the game to a - [VASSAL](#VASSAL-support) module +The result will often be a PDF (or set of PDFs) that contain everything +one will need for a game (rules, charts, boards, counter sheets). -## Sources +- The package uses [NATO App6](#nato-app6 "Section below") symbology + for units. +- The package uses [TikZ](https://github.com/pgf-tikz/pgf) for most + things. +- The package support exporting the game to a + [VASSAL](#vassal-support%20'Section%20below') module -The sources of the package are kept at [GitLab][3] +## Sources -## CTAN +The sources of the package are kept at +[GitLab](https://gitlab.com/wargames_tex/wargame_tex) -The package is available from [CTAN][4] in the directory -`/macros/latex/contrib/wargame`. As of this writing, the package has -not hit any of the major distributions (e.g., [TeXLive][5]). +## CTAN -If you get the sources (`wargame.ins`, all `.dtx` and `.py`) files, -then to install do +The package is available from +[CTAN](https://ctan.org/tex-archive/macros/latex/contrib/wargame) in the +directory `/macros/latex/contrib/wargame`. As of this writing, the +package has not hit any of the major distributions (e.g., +[TeXLive](https://tug.org/texlive/index.html)). - latex wargame.ins +If you get the sources (`wargame.ins`, all `.dtx` and `.py`) files, then +to install do + + latex wargame.ins pdflatex beach pdflatex city - pdflatex light_woods + pdflatex light_woods pdflatex mountains pdflatex rough pdflatex swamp @@ -47,224 +53,213 @@ then to install do (You need to use `pdflatex`, `xelatex`, or `lualatex` - plain `latex` with DVI output will not work) -Then copy the relevant files to your TeX tree (e.g., `~/texmf/`) -as +Then copy the relevant files to your TeX tree (e.g., `~/texmf/`) as mkdir ~/texmf/tex/latex/wargame - cp tikzlibrary*.tex ~/texmf/tex/latex/wargame/ - cp wargame.sty ~/texmf/tex/latex/wargame/ - cp wgexpor.sty ~/texmf/tex/latex/wargame/ + cp tikzlibrary*.tex ~/texmf/tex/latex/wargame/ + cp wargame.sty ~/texmf/tex/latex/wargame/ + cp wgexpor.sty ~/texmf/tex/latex/wargame/ cp city.pdf ~/texmf/tex/latex/wargame/ - cp light_woods.pdf ~/texmf/tex/latex/wargame/ + cp light_woods.pdf ~/texmf/tex/latex/wargame/ cp mountains.pdf ~/texmf/tex/latex/wargame/ cp rough.pdf ~/texmf/tex/latex/wargame/ cp swamp.pdf ~/texmf/tex/latex/wargame/ cp town.pdf ~/texmf/tex/latex/wargame/ cp village.pdf ~/texmf/tex/latex/wargame/ cp woods.pdf ~/texmf/tex/latex/wargame/ - cp export.py ~/texmf/tex/latex/wargame/ - cp svg2tikz.py ~/texmf/tex/latex/wargame/ - -To generate the documentation, after having done the above, do - - pdflatex wargame.dtx - makeindex -s gind -o wargame.ind wargame.idx - pdflatex wargame.dtx - pdflatex wargame.dtx - pdflatex symbols.tex - pdflatex compat.tex - pdflatex compat.tex - + cp export.py ~/texmf/tex/latex/wargame/ + cp svg2tikz.py ~/texmf/tex/latex/wargame/ + +To generate the documentation, after having done the above, do + + pdflatex wargame.dtx + makeindex -s gind -o wargame.ind wargame.idx + pdflatex wargame.dtx + pdflatex wargame.dtx + pdflatex symbols.tex + pdflatex compat.tex + pdflatex compat.tex + (You need to use `pdflatex`, `xelatex`, or `lualatex` - plain `latex` with DVI output will not work) -You can install these into your TeX tree with (e.g., `~/texmf/`) +You can install these into your TeX tree with (e.g., `~/texmf/`) - mkdir -p ~/texmf/doc/latex/wargame/ + mkdir -p ~/texmf/doc/latex/wargame/ cp wargame.pdf ~/texmf/doc/latex/wargame/ - cp symbols.py ~/texmf/doc/latex/wargame/ - cp compat.py ~/texmf/doc/latex/wargame/ - -If you want to generate the tutorial document, do - - cd tutorial - pdflatex game - pdflatex game - + cp symbols.py ~/texmf/doc/latex/wargame/ + cp compat.py ~/texmf/doc/latex/wargame/ + +If you want to generate the tutorial document, do + + cd tutorial + pdflatex game + pdflatex game + If you also want to make the tutorial VASSAL module, do (also in -`tutorial`), do - - pdflatex export.tex - ../export.py export.pdf export.json -o Game.vmod \ - -d "Example module from LaTeX PnP game" \ - -t "LaTeX wargame tutorial" -v 0.1 \ - -p patch.py - - - - -## Download from GitLab - -- [Zip file of package and support files][artifacts.zip] -- [Browse content of package][browse] -- [Documentation][wargame.pdf] -- [Tutorial][tutorial.pdf] (and associated VASSAL [module][Game.vmod]) -- [Table of symbols][symbols.pdf] -- [Compatibility][compat.pdf] - -To install, get the ([zip file][artifacts.zip]) and unzip into your -TeX tree, for example - - mkdir -p ~/texmf - (cd ~/texmf && unzip ../artifacts.zip) - -on Un*x like systems. - -## Tutorial - -See the [tutorial](tutorial/README.md) page for more. - -## Examples - -Below are some print'n'play board wargames made with this package. -These are not original games but rather revamps of existing games. -All credits goes to the original authors of these games. - -- WWII - - Eastern Front - - [Battle for Moscow][bfm_tex] - - [Hell's Gate][hellsgate_tex] (private) - - [Unternehmung 25][unternehmung_tex] (private) - - Western Front - - [D-Day][dday_tex] (Avalon Hill classic) - - [Paul Koenig's Market Garden][pkmg_tex] - - [Paul Koenig's D-Day][pkdday_tex] - - Pacific theatre - - [First Blood][firstblood_tex] (Avalon Hill International - Kriegspiel Association classic) - - [Malaya][malaya_tex] (private) - - Africa - - [Afrika Korps][afrikakorps_tex] (Avalon Hill classic) - - [Battles of El Alamein][boel_tex] (private) -- Modern/Speculative - - [Strike Force One][sfo_tex] - - [Kriegspiel][kriegspiel_tex] (Avalon Hill classic) +`tutorial`), do + + pdflatex export.tex + ../export.py export.pdf export.json -o Game.vmod \ + -d "Example module from LaTeX PnP game" \ + -t "LaTeX wargame tutorial" -v 0.1 \ + -p patch.py + +## Download from GitLab + +- [Zip file of package and support + files](https://gitlab.com/wargames_tex/wargame_tex/-/jobs/artifacts/master/download?job=dist) +- [Browse content of + package](https://gitlab.com/wargames_tex/wargame_tex/-/jobs/artifacts/master/browse?job=dist) +- [Documentation](https://gitlab.com/wargames_tex/wargame_tex/-/jobs/artifacts/master/file/public/doc/latex/wargame/wargame.pdf?job=dist) +- [Tutorial](https://gitlab.com/wargames_tex/wargame_tex/-/jobs/artifacts/master/file/public/doc/latex/wargame/tutorial.pdf?job=dist) + (and associated VASSAL + [module](https://gitlab.com/wargames_tex/wargame_tex/-/jobs/artifacts/master/file/public/doc/latex/wargame/Game.vmod?job=dist)) +- [Table of + symbols](https://gitlab.com/wargames_tex/wargame_tex/-/jobs/artifacts/master/file/public/doc/latex/wargame/symbols.pdf?job=dist) +- [Compatibility](https://gitlab.com/wargames_tex/wargame_tex/-/jobs/artifacts/master/file/public/doc/latex/wargame/compat.pdf?job=dist) + +To install, get the ([zip +file](https://gitlab.com/wargames_tex/wargame_tex/-/jobs/artifacts/master/download?job=dist)) +and unzip into your TeX tree, for example + + mkdir -p ~/texmf + (cd ~/texmf && unzip ../artifacts.zip) + +on Un\*x like systems. + +## Tutorial + +See the [tutorial](tutorial/README.md "Link works on GitLab only") page +for more +([here](https://ctan.org/tex-archive/macros/latex/contrib/wargame/doc/tutorial/) +if you browse from CTAN). + +## Examples + +Below are some print'n'play board wargames made with this package. These +are not original games but rather revamps of existing games. All credits +goes to the original authors of these games. + +- WWII + - Eastern Front + - [Battle for Moscow](https://gitlab.com/wargames_tex/bfm_tex) + - [Hell's Gate](https://gitlab.com/wargames_tex/hellsgate_tex) + (private) + - [Unternehmung + 25](https://gitlab.com/wargames_tex/unternehmung_tex) + (private) + - Western Front + - [D-Day](https://gitlab.com/wargames_tex/dday_tex) (Avalon + Hill classic) + - [Paul Koenig's Market + Garden](https://gitlab.com/wargames_tex/pkmg_tex) + - [Paul Koenig's + D-Day](https://gitlab.com/wargames_tex/pkdday_tex) + - Pacific theatre + - [First + Blood](https://gitlab.com/wargames_tex/firstblood_tex) + (Avalon Hill International Kriegspiel Association classic) + - [Malaya](https://gitlab.com/wargames_tex/malaya_tex) + (private) + - Africa + - [Afrika + Korps](https://gitlab.com/wargames_tex/afrikakorps_tex) + (Avalon Hill classic) + - [Battles of El + Alamein](https://gitlab.com/wargames_tex/boel_tex) (private) +- Modern/Speculative + - [Strike Force One](https://gitlab.com/wargames_tex/sfo_tex) + - [Kriegspiel](https://gitlab.com/wargames_tex/kriegspiel_tex) + (Avalon Hill classic) ## VASSAL support -The packages has the script [`export.py`](utils/export.py) to -generate a draft [VASSAL][5] module from the defined charts, boards, -counters, OOBs, and so on. More about this is given in the -documentation. +The packages has the script [`export.py`](utils/export.py) to generate a +draft [VASSAL](https://vassalengine.org) module from the defined charts, +boards, counters, OOBs, and so on. More about this is given in the +documentation. The script will generate a first draft of a module, which then can be -edited in the VASSAL editor for the final thing. +edited in the VASSAL editor for the final thing. Alternatively, one can provide a Python script to do more on the generated module, such as defining starting positions, fixing grid -layouts, and so on. Using such a patch script, one can get an -(almost) final module. This means, that even if one makes changes to -the original content, it is easy to remake the module without much -need for the VASSAL editor. - -An example of this is given in the [Battle for Moscow][bfm_tex] -project, and of course in the [tutorial](tutorial/) - -## NATO App6 - -The package supports - -- All air, equipment, installation, land, sea surface, sub surface, - and space command symbols, including amplifiers and modifiers -- All friendly, hostile, neutral, and unknown faction frame. - Undecided faction frames can be made by specifying `dashed` line - styles. -- Some, but very few, other kinds of symbology. - -Here are some references for more information on the NATO App6 -symbology standard. - -- The [Wikipedia page][6] on NATO Joint Military Symbology -- The [NATO page][7]. If this does not work for you, then try to go - to the [standards page][8] and put in and write in `SYMBOLOGY` in - the _Document Title Contains Words_ field and press _Start_. -- Other LaTeX package for making NATO symbology [XMilSymb][9] +layouts, and so on. Using such a patch script, one can get an (almost) +final module. This means, that even if one makes changes to the original +content, it is easy to remake the module without much need for the +VASSAL editor. + +An example of this is given in the [Battle for +Moscow](https://gitlab.com/wargames_tex/bfm_tex) project, and of course +in the [tutorial](tutorial/ "Link works on GitLab only") + +## NATO App6 + +The package supports + +- All air, equipment, installation, land, sea surface, sub surface, + and space command symbols, including amplifiers and modifiers +- All friendly, hostile, neutral, and unknown faction frame. Undecided + faction frames can be made by specifying `dashed` line styles. +- Some, but very few, other kinds of symbology. + +Here are some references for more information on the NATO App6 symbology +standard. + +- The [Wikipedia + page](https://en.wikipedia.org/wiki/NATO_Joint_Military_Symbology) + on NATO Joint Military Symbology +- The [NATO + page](https://nso.nato.int/nso/nsdd/main/standards/ap-details/1912/EN). + If this does not work for you, then try to go to the [standards + page](https://nso.nato.int/nso/nsdd/main/standards) and put in and + write in `SYMBOLOGY` in the *Document Title Contains Words* field + and press *Start*. +- Other LaTeX package for making NATO symbology + [XMilSymb](https://github.com/ralphieraccoon/MilSymb) ## Copyright and license -(c) 2022 Christian Holm Christensen +(c) 2022 Christian Holm Christensen -This work is licensed under the Creative Commons -Attribution-ShareAlike 4.0 International License (CC-BY-SA-4.0). To -view a copy of this license, visit [CC][10] or send a letter to -Creative Commons, PO Box 1866, Mountain View, CA 94042, USA. +This work is licensed under the Creative Commons Attribution-ShareAlike +4.0 International License (CC-BY-SA-4.0). To view a copy of this +license, visit [CC](http://creativecommons.org/licenses/by-sa/4.0/) or +send a letter to Creative Commons, PO Box 1866, Mountain View, CA 94042, +USA. -### Some comments on copyright +### Some comments on copyright -_Caveat_: I am not a lawyer. +*Caveat*: I am not a lawyer. -Note that this license applies to the `wargame` package as such. What -you generate using the package is _not_ required to be licensed -according to the _ShareAlike_ clause of CC-BY-SA-4.0. That is, you -can license your materials _any way you want_. +Note that this license applies to the `wargame` package as such. What +you generate using the package is *not* required to be licensed +according to the *ShareAlike* clause of CC-BY-SA-4.0. That is, you can +license your materials *any way you want*. -However, that copyright rights on games is not as prohibitive as you -may think (see [this thread on BGG][11]). What you _can_ copyright is -original, artistic expression. That is, the copyrighted work must not -be a copy of something else (originality) and must be some form of -expression. One _cannot_ copyright ideas, only their expression in so -far as it is _artistic_ (i.e., not a trivial expression that anyone -knowledgeable within the field can do with rudimentary effort). +However, that copyright rights on games is not as prohibitive as you may +think (see [this thread on +BGG](https://boardgamegeek.com/thread/493249/)). What you *can* +copyright is original, artistic expression. That is, the copyrighted +work must not be a copy of something else (originality) and must be some +form of expression. One *cannot* copyright ideas, only their expression +in so far as it is *artistic* (i.e., not a trivial expression that +anyone knowledgeable within the field can do with rudimentary effort). -So you _can not_ copyright your game mechanics, for example, only how -you described them. You _can not_ copyright a title (but you may be -able to claim trademark on it). You _can_ copyright the wording of -the rules, the graphics that you use, and so on. +So you *can not* copyright your game mechanics, for example, only how +you described them. You *can not* copyright a title (but you may be able +to claim trademark on it). You *can* copyright the wording of the rules, +the graphics that you use, and so on. -This also means, that you are essentially free to make your own -version of previously published game, _as long as_ +This also means, that you are essentially free to make your own version +of previously published game, *as long as* -- you do not copy existing text -- you do not copy existing graphics -- you respect any kind of trademark claims +- you do not copy existing text +- you do not copy existing graphics +- you respect any kind of trademark claims However, it is advisable to contact the copyright holders of the -previously published game to avoid [SNAFU][12]. If in doubt, seek -professional help. - -[1]: https://en.wikipedia.org/wiki/Wargame -[2]: https://github.com/pgf-tikz/pgf -[3]: https://gitlab.com/wargames_tex/wargame_tex -[4]: https://ctan.org/tex-archive/macros/latex/contrib/wargame -[5]: https://tug.org/texlive/index.html -[6]: https://vassalengine.org -[7]: https://en.wikipedia.org/wiki/NATO_Joint_Military_Symbology -[8]: https://nso.nato.int/nso/nsdd/main/standards/ap-details/1912/EN -[9]: https://nso.nato.int/nso/nsdd/main/standards -[10]: https://github.com/ralphieraccoon/MilSymb -[11]: http://creativecommons.org/licenses/by-sa/4.0/ -[12]: https://boardgamegeek.com/thread/493249/ -[13]: https://en.wikipedia.org/wiki/SNAFU - - -[artifacts.zip]: https://gitlab.com/wargames_tex/wargame_tex/-/jobs/artifacts/master/download?job=dist -[browse]: https://gitlab.com/wargames_tex/wargame_tex/-/jobs/artifacts/master/browse?job=dist -[wargame.pdf]: https://gitlab.com/wargames_tex/wargame_tex/-/jobs/artifacts/master/file/public/doc/latex/wargame/wargame.pdf?job=dist -[tutorial.pdf]: https://gitlab.com/wargames_tex/wargame_tex/-/jobs/artifacts/master/file/public/doc/latex/wargame/tutorial.pdf?job=dist -[Game.vmod]: https://gitlab.com/wargames_tex/wargame_tex/-/jobs/artifacts/master/file/public/doc/latex/wargame/Game.vmod?job=dist -[symbols.pdf]: https://gitlab.com/wargames_tex/wargame_tex/-/jobs/artifacts/master/file/public/doc/latex/wargame/symbols.pdf?job=dist -[compat.pdf]: https://gitlab.com/wargames_tex/wargame_tex/-/jobs/artifacts/master/file/public/doc/latex/wargame/compat.pdf?job=dist - -[bfm_tex]: https://gitlab.com/wargames_tex/bfm_tex -[hellsgate_tex]: https://gitlab.com/wargames_tex/hellsgate_tex -[unternehmung_tex]: https://gitlab.com/wargames_tex/unternehmung_tex -[dday_tex]: https://gitlab.com/wargames_tex/dday_tex -[pkmg_tex]: https://gitlab.com/wargames_tex/pkmg_tex -[pkdday_tex]: https://gitlab.com/wargames_tex/pkdday_tex -[firstblood_tex]: https://gitlab.com/wargames_tex/firstblood_tex -[malaya_tex]: https://gitlab.com/wargames_tex/malaya_tex -[afrikakorps_tex]: https://gitlab.com/wargames_tex/afrikakorps_tex -[boel_tex]: https://gitlab.com/wargames_tex/boel_tex -[sfo_tex]: https://gitlab.com/wargames_tex/sfo_tex -[kriegspiel_tex]: https://gitlab.com/wargames_tex/kriegspiel_tex - +previously published game to avoid +[SNAFU](https://en.wikipedia.org/wiki/SNAFU). If in doubt, seek +professional help. diff --git a/macros/latex/contrib/wargame/doc/compat.pdf b/macros/latex/contrib/wargame/doc/compat.pdf index 02dbab19cd..3e9956c6d7 100644 Binary files a/macros/latex/contrib/wargame/doc/compat.pdf and b/macros/latex/contrib/wargame/doc/compat.pdf differ diff --git a/macros/latex/contrib/wargame/doc/symbols.pdf b/macros/latex/contrib/wargame/doc/symbols.pdf index 0f0ace1efb..20dcb7101b 100644 Binary files a/macros/latex/contrib/wargame/doc/symbols.pdf and b/macros/latex/contrib/wargame/doc/symbols.pdf differ diff --git a/macros/latex/contrib/wargame/doc/wargame.pdf b/macros/latex/contrib/wargame/doc/wargame.pdf index aeb06a386d..a030c938f4 100644 Binary files a/macros/latex/contrib/wargame/doc/wargame.pdf and b/macros/latex/contrib/wargame/doc/wargame.pdf differ diff --git a/macros/latex/contrib/wargame/source/Makefile b/macros/latex/contrib/wargame/source/Makefile index 656439e408..bfb4db8e27 100644 --- a/macros/latex/contrib/wargame/source/Makefile +++ b/macros/latex/contrib/wargame/source/Makefile @@ -2,7 +2,7 @@ # # NAME := wargame -VERSION := 0.2 +VERSION := 0.2.1 LATEX_FLAGS := -interaction=nonstopmode \ -file-line-error \ --synctex=15 \ @@ -273,7 +273,7 @@ logo.png:logo.pdf README.md.version:README.md @echo "Versioned README.md" $(MUTE)$(SED) 's/^# \(.*\)/# \1\n## Version $(VERSION)/' \ - < $< > $@ + < $< | pandoc --to markdown > $@ ctandir: all tutorial/game.pdf README.md.version @echo "Preparing CTAN directory" @@ -286,7 +286,7 @@ ctandir: all tutorial/game.pdf README.md.version $(MUTE)$(MAKE) distdir distsdir:=tmp/$(srcdir) $(REDIR) $(MUTE)mkdir -p $(ctandir)/$(NAME) $(MUTE)cp tmp/$(docdir)/README.md $(ctandir)/$(NAME)/ - #$(MUTE)(cd tmp && zip -q -r ../$(ctandir)/$(NAME).tds.zip *) + $(MUTE)(cd tmp && zip -q -r ../$(ctandir)/$(NAME).tds.zip *) $(MUTE)(cd tmp && cp -a $(docdir) ../$(ctandir)/$(NAME)/doc) $(MUTE)(cd tmp && cp -a $(srcdir) ../$(ctandir)/$(NAME)/source) $(MUTE) rm -rf tmp @@ -317,7 +317,7 @@ docker: docker-prep: apt update - apt install -y poppler-utils python3-pil \ + apt install -y poppler-utils python3-pil pandoc \ libwww-mechanize-perl libfile-copy-recursive-perl pwd ls diff --git a/macros/latex/contrib/wargame/source/hex/core.dtx b/macros/latex/contrib/wargame/source/hex/core.dtx index 1847ad42c8..ee04290955 100644 --- a/macros/latex/contrib/wargame/source/hex/core.dtx +++ b/macros/latex/contrib/wargame/source/hex/core.dtx @@ -62,6 +62,7 @@ \@ifundefined{ifhex@terrain@pic}{% \newif\ifhex@terrain@pic \hex@terrain@pictrue}{} +\def\markpos#1(#2){} % \end{macrocode} % % \iffalse diff --git a/macros/latex/contrib/wargame/source/util/core.dtx b/macros/latex/contrib/wargame/source/util/core.dtx index a3c656a2b3..506cb19ece 100644 --- a/macros/latex/contrib/wargame/source/util/core.dtx +++ b/macros/latex/contrib/wargame/source/util/core.dtx @@ -766,7 +766,7 @@ \chit@dbg{2}{chits to make images of `#2'}% \foreach[count=\ti from 0] \t/\x in #2{% \ifx\t\empty\else% Ignore empty rows - \message{^^JSubcategory: `\x' (default `#1')} + \chit@dbg{5}{^^JSubcategory: `\x' (default `#1')} \ifx\t\x\def\x{#1}\fi% Take sub-category or default \foreach \u/\m in \t{% \ifx\u\empty\else% Ignore empty cells @@ -812,7 +812,7 @@ \let\natoapp@report\do@natoapp@report% \foreach[count=\ti from 0] \t/\x in #2{% \ifx\t\empty\else% Ignore empty rows - \message{^^JSubcategory: `\x' (default `#1')} + \chit@dbg{5}{^^JSubcategory: `\x' (default `#1')} \ifx\t\x\def\x{#1}\fi% Take sub-category or default \foreach \u/\m in \t{% \ifx\u\empty\else% Ignore empty cells @@ -981,15 +981,37 @@ \pt@to@cm{#2}\edef\y{\pgfmathresult}} % \end{macrocode} % \begin{macrocode} +\def\mk@get@anchor#1#2{% + \pgfpointanchor{#1}{#2}% + \pgfgetlastxy\tmp@x\tmp@y% + \pt@to@cm{\tmp@x}\edef\tmp@x{\pgfmathresult} + \pt@to@cm{\tmp@y}\edef\tmp@y{\pgfmathresult} +} +\def\mk@get@global@anchor#1#2{% + \pgfpointanchor{#1}{#2}% + \pgfgetlastxy\tmp@x\tmp@y% + \pgfpointtransformed{\pgfpoint{\tmp@x}{\tmp@y}} + \pgf@xa=\pgf@x + \pgf@ya=\pgf@y + \pt@to@cm{\the\pgf@xa}\edef\tmp@x{\pgfmathresult} + \pt@to@cm{\the\pgf@ya}\edef\tmp@y{\pgfmathresult} +} \def\get@bb#1{% - \pgfpointanchor{#1}{south west}% - \pgfgetlastxy\tmp@llx\tmp@lly% - \pgfpointanchor{#1}{north east}% - \pgfgetlastxy\tmp@urx\tmp@ury% - \pt@to@cm{\tmp@llx}\edef\llx{\pgfmathresult} - \pt@to@cm{\tmp@lly}\edef\lly{\pgfmathresult} - \pt@to@cm{\tmp@urx}\edef\urx{\pgfmathresult} - \pt@to@cm{\tmp@ury}\edef\ury{\pgfmathresult}} + % \pgfpointanchor{#1}{south west}% + % \pgfgetlastxy\tmp@llx\tmp@lly% + % \pgfpointanchor{#1}{north east}% + % \pgfgetlastxy\tmp@urx\tmp@ury% + % \pt@to@cm{\tmp@llx}\edef\llx{\pgfmathresult} + % \pt@to@cm{\tmp@lly}\edef\lly{\pgfmathresult} + % \pt@to@cm{\tmp@urx}\edef\urx{\pgfmathresult} + % \pt@to@cm{\tmp@ury}\edef\ury{\pgfmathresult} + \mk@get@anchor{#1}{south west} + \edef\llx{\tmp@x} + \edef\lly{\tmp@y} + \mk@get@anchor{#1}{north east} + \edef\urx{\tmp@x} + \edef\ury{\tmp@y} +} % \end{macrocode} % \begin{macrocode} \def\mk@transform{% @@ -1011,26 +1033,35 @@ \mk@w{ \mk@i "upper right": [\urx,\ury],} \begingroup % \pgftransforminvert - \pgfpointanchor{#1}{south west}% - \pgfgetlastxy\tmp@llx\tmp@lly% - \pgfpointtransformed{\pgfpoint{\tmp@llx}{\tmp@lly}} - \pgf@xa=\pgf@x - \pgf@ya=\pgf@y - % - \pgfpointanchor{#1}{north east}% - \pgfgetlastxy\tmp@urx\tmp@ury% - \pgfgetlastxy\tmp@llx\tmp@lly% - \pgfpointtransformed{\pgfpoint{\tmp@urx}{\tmp@ury}} - \pgf@xb=\pgf@x - \pgf@yb=\pgf@y - \pt@to@cm{\the\pgf@xa}\edef\llx{\pgfmathresult} - \pt@to@cm{\the\pgf@ya}\edef\lly{\pgfmathresult} - \pt@to@cm{\the\pgf@xb}\edef\urx{\pgfmathresult} - \pt@to@cm{\the\pgf@yb}\edef\ury{\pgfmathresult}x - \mk@w{ \mk@i "global lower left": [\llx,\lly],} - \mk@w{ \mk@i "global upper right": [\urx,\ury]} + % \pgfpointanchor{#1}{south west}% + % \pgfgetlastxy\tmp@llx\tmp@lly% + % \pgfpointtransformed{\pgfpoint{\tmp@llx}{\tmp@lly}} + % \pgf@xa=\pgf@x + % \pgf@ya=\pgf@y + % % + % \pgfpointanchor{#1}{north east}% + % \pgfgetlastxy\tmp@urx\tmp@ury% + % \pgfgetlastxy\tmp@llx\tmp@lly% + % \pgfpointtransformed{\pgfpoint{\tmp@urx}{\tmp@ury}} + % \pgf@xb=\pgf@x + % \pgf@yb=\pgf@y + % \pt@to@cm{\the\pgf@xa}\edef\llx{\pgfmathresult} + % \pt@to@cm{\the\pgf@ya}\edef\lly{\pgfmathresult} + % \pt@to@cm{\the\pgf@xb}\edef\urx{\pgfmathresult} + % \pt@to@cm{\the\pgf@yb}\edef\ury{\pgfmathresult}x + \mk@get@global@anchor{#1}{south west} + \mk@w{ \mk@i "global lower left": [\tmp@x,\tmp@y],} + \mk@get@global@anchor{#1}{north east} + \mk@w{ \mk@i "global upper right": [\tmp@x,\tmp@y]} \endgroup } +\def\mk@pos#1(#2){% + \hex@dbg{10}{^^JMarking `#2' with `#1' - start} + \coordinate[transform shape] (tmp) at (#2) {}; + \mk@get@anchor{tmp}{center} + \hex@dbg{3}{^^JMarking `#2' with `#1' - `\tmp@x',\tmp@y'} + \tikzset{zone point={#1}{\tmp@x}{\tmp@y}} +} % \end{macrocode} % % For the key \texttt{zone path} to work, we need to be able to record @@ -1079,6 +1110,7 @@ \newcount\mk@point \mk@point=0 \let\oomk@i\mk@i% + \let\markpos\mk@pos% % \end{macrocode} % % @@ -1103,7 +1135,6 @@ \edef\mk@i{\mk@i\space} %% Everything is made into centimeters \mk@w{ \mk@i "units": "cm",} - \message{^^Jlabel: \meaning\mk@label} \@ifundefined{mk@label}{}{\mk@w{ \mk@i "labels": "\mk@label",}} %% Write out coordinate options as "coords" object \mk@w{ \mk@i"coords": \@lbchar}% @@ -1180,8 +1211,6 @@ % point - f.ex. in a node - and outputs that % \begin{macrocode} zone point/.code n args={3}{ - \advance\mk@point1 - \global\mk@point=\mk@point \pgf@xa=##2 cm \pgf@ya=##3 cm \pgfpointtransformed{\pgfpoint{\pgf@xa}{\pgf@ya}} @@ -1190,10 +1219,18 @@ \pgf@ya=\pgf@y \pt@to@cm{\the\pgf@xa}\edef\px{\pgfmathresult} \pt@to@cm{\the\pgf@ya}\edef\py{\pgfmathresult} + \advance\mk@point1 + \global\mk@point=\mk@point \mk@w{ \mk@i "point\the\mk@point": \@lbchar "name": "##1", "type": "point", "coords": [\px,\py] \@rbchar, } %\message{^^JZone point \the\mk@point\space ##1: ##2,##3 -> \px,\py} }, + zone global point/.code n args={3}{ + \advance\mk@point1 + \global\mk@point=\mk@point + \mk@w{ \mk@i "point\the\mk@point": \@lbchar "name": "##1", "type": "point", "coords": [\px,\py] + \@rbchar, } + }, % \end{macrocode} % % The \texttt{zone path} style is a bit more simple, but only because diff --git a/macros/latex/contrib/wargame/source/utils/export.py b/macros/latex/contrib/wargame/source/utils/export.py index b60cbb0fc5..d62c9e5f77 100755 --- a/macros/latex/contrib/wargame/source/utils/export.py +++ b/macros/latex/contrib/wargame/source/utils/export.py @@ -286,6 +286,31 @@ def get_doc(string): def get_game(doc): return doc.getElementsByTagName('VASSAL.build.GameModule')[0] +# -------------------------------------------------------------------- +def get_globalproperties(doc,one=True): + return get_asone(doc,MODULE+'properties.GlobalProperties',one) + +# -------------------------------------------------------------------- +def get_globalproperty(doc,asdict=True): + '''A little confusing - this returns a dictionary''' + return get_asdict(doc,MODULE+'properties.GlobalProperty','name',asdict) + +# -------------------------------------------------------------------- +def get_turntrack(doc,asdict=True): + return get_asdict(doc,MODULE+'turn.TurnTracker','name',asdict) + +# -------------------------------------------------------------------- +def get_turncounter(doc,asdict=True): + return get_asdict(doc,MODULE+'turn.CounterTurnLevel','property',asdict) + +# -------------------------------------------------------------------- +def get_turnlist(doc,asdict=True): + return get_asdict(doc,MODULE+'turn.ListTurnLevel','property',asdict) + +# -------------------------------------------------------------------- +def get_turnhotkey(doc,asdict=True): + return get_asdict(doc,MODULE+'turn.TurnGlobalHotkey','hotkey',asdict) + # -------------------------------------------------------------------- def get_documentation(doc,one=True): return get_asone(doc,MODULE+'Documentation',one) @@ -355,6 +380,10 @@ def get_squarenumbering(doc,one=True): def get_pieces(doc,asdict=True): return get_asdict(doc,WIDGET+'PieceSlot','entryName',asdict) +# -------------------------------------------------------------------- +def get_prototypecontainer(doc,one=True): + return get_asone(doc,MODULE+'PrototypesContainer',one) + # -------------------------------------------------------------------- def get_prototypes(doc,asdict=True): return get_asdict(doc,MODULE+'PrototypeDefinition', 'name',asdict) @@ -444,9 +473,14 @@ def dicts_to_piece(traits): # ==================================================================== -# Key encoding +# Key encoding +SHIFT = 65 CTRL = 130 ALT = 520 +CTRL_SHIFT = CTRL+SHIFT +ALT_SHIFT = ALT+SHIFT +NONE = '\ue004' +NONE_MOD = 0 def key(let,mod=CTRL): '''Encode a key sequence @@ -510,9 +544,142 @@ def add_basiccommandencoder(root,doc): return add_node(root,doc,MODULE+'BasicCommandEncoder') # -------------------------------------------------------------------- -def add_globalproperties(root,elem): - return add_node(root,elem,MODULE+'properties.GlobalProperties') +def add_globalproperties(root,elem,*props,**named): + gp = add_node(root,elem,MODULE+'properties.GlobalProperties') + # Add elements where each is a dict with _at least_ + # "{'name':NAME, 'initialValue':VALUE}" + for p in props: + add_globalproperty(root,gp,**p) + # Add elements where each is a named dict with _at least_ + # "{'initialValue':VALUE}" + for n, p in named: + add_globalproperty(root,gp,name=n,**p) + + return gp + +# -------------------------------------------------------------------- +def add_globalproperty(root,elem,name,initialValue, + isNumeric = False, + min = "null", + max = "null", + wrap = False, + description = ""): + return add_node(root,elem,MODULE+'properties.GlobalProperty', + name = name, + initialValue = initialValue, + isNumeric = isNumeric, + min = min, + max = max, + wrap = wrap, + description = description) + +# -------------------------------------------------------------------- +def add_turntrack(root, elem, name, + buttonText = 'Turn', + hotkey = '', + icon = '', + length = -1, + lengthStyle = 'Maximum', + nexthotkey = key('T',ALT), + plusButtonSize = 22, + prevhotkey = key('T',ALT_SHIFT), + reportFormat = '<$PlayerId$> Turn updated from $oldTurn$ to $newTurn$', + turnButtonHeight = 22, + turnFormat = None, + counter = None, + phases = None): + + levels = (counter if counter is not None else + phases if phases is not None else None) + if levels is not None: + lvl = 1 + lvls = [f'$level{lvl}$'] + sub = levels + while True: + sub = sub.get('counter',sub.get('phases',None)) + if sub is None: + break + lvl += 1 + lvls.append(f'$level{lvl}$') + + turnFormat = ' '.join(lvls) + + if turnFormat is None: + turnFormat = '$level1$ $level2$ $level3$ $level4$' + + t = add_node(root, elem, MODULE+'turn.TurnTracker', + name = name, + buttonText = buttonText, + hotkey = hotkey, + icon = icon, + length = length, + lengthStyle = lengthStyle, + nexthotkey = nexthotkey, + plusButtonSize = plusButtonSize, + prevhotkey = prevhotkey, + reportFormat = reportFormat, + turnButtonHeight = turnButtonHeight, + turnFormat = turnFormat) + + add_turnlevel(root, t, counter=counter, phases=phases) + + return t + +# -------------------------------------------------------------------- +def add_turnlevel(root,parent,counter=None,phases=None): + f,s = ((add_turncounter,counter) if counter is not None else + (add_turnlist,phases) if phases is not None else (None,None)) + if f is None: return parent + + subcounter = s.pop('counter',None) + subphases = s.pop('phases',None) + + sub = f(root,parent,**s) + + return add_turnlevel(root,sub,counter=subcounter,phases=subphases) + +# -------------------------------------------------------------------- +def add_turncounter(root,elem,property, + incr = 1, + loop = False, + loopLimit = -1, + turnFormat = "$value$"): + c = add_node(root,elem,MODULE+"turn.CounterTurnLevel", + property = property, + incr = incr, + loop = loop, + loopLimit = loopLimit, + turnFormat = turnFormat) + return c + +# -------------------------------------------------------------------- +def add_turnlist(root,elem,property,names, + configFirst = False, + configList = False, + turnFormat = '$value$'): + c = add_node(root,elem,MODULE+"turn.ListTurnLevel", + property = property, + list = ','.join([str(p) for p in names]), + configFirst = configFirst, + configList = configList, + turnFormat = turnFormat) + return c + +# -------------------------------------------------------------------- +def add_turnhotkey(root,elem, + hotkey, + match = '{phase=="first"}', + reportFormat = '{PlayerName}', + name = ''): + return add_node(root,elem,MODULE+'turn.TurnGlobalHotkey', + hotkey = hotkey, + match = match, + reportFormat = reportFormat, + name = name) + + + # -------------------------------------------------------------------- def add_translatable(root,elem): return add_node(root,elem,MODULE+'properties.GlobalTranslatableMessages') @@ -888,7 +1055,7 @@ def add_squarenumbering(root,grid, # -------------------------------------------------------------------- def add_regiongrid(root,zone,snapto=True,fontsize=9,visible=True): - print(f'Make region grid visible: {visible}') + # print(f'Make region grid visible: {visible}') return add_node(root,zone,PICKER+'board.RegionGrid', fontsize = fontsize, snapto = snapto, @@ -916,8 +1083,8 @@ def get_region_piece(root,grid,name,alsoPiece=True,piece=None,verbose=False): # Find the piece by searching from the top of the tree piece = get_pieces(root,root).get(name,None) - if piece is None: - print(list(get_pieces(root,root).keys())) + # if piece is None: + # print(list(get_pieces(root,root).keys())) if verbose: print(f' Possible piece for region {name}: {piece}') return piece, map @@ -965,7 +1132,7 @@ def add_region(root,grid,name,originx,originy,gpid, if verbose: print(f' Add piece {name} to region') _, gpid = add_atstart(root,map,name,piece, - location = name, + location = nam, useGridLocation = True, owningBoard = map.getAttribute('mapName'), x = 0, @@ -1310,6 +1477,7 @@ def add_prototype(root,elem,name,code,description=''): name = name, description = description) add_text(root,d,code) + return d # -------------------------------------------------------------------- def add_piecewindow(root,elem,name, @@ -1694,7 +1862,7 @@ def delete_trait(name = 'Delete', key = key('D')): # -------------------------------------------------------------------- def sendto_trait(mapName, boardName, - name = 'Eliminate', + name = '', key = key('E'), restoreName = 'Restore', restoreKey = key('R'), @@ -1704,7 +1872,7 @@ def sendto_trait(mapName, yidx = 0, xoff = 1, yoff = 1, - description = 'Eliminate this unit', + description = '', destination = 'L', zone = '', region = '', @@ -1857,6 +2025,15 @@ def add_proto(typ,state): return add_piece(typ,state) +# -------------------------------------------------------------------- +def add_proto_code(decs): + typs = [d[0] for d in decs] + stts = [d[1] for d in decs] + typ = enc_parts(*typs) + stt = enc_parts(*stts) + + return add_proto(typ,stt) + # ==================================================================== # # Below specific to the export app @@ -1960,12 +2137,13 @@ def proto_body(family): cmd : str The command to add the piece ''' - # Dummy image + # Dummy image decs = [ report_trait(key('E'),key('R'),key('M')), moved_trait(), trail_trait(), delete_trait(), - sendto_trait('DeadMap',family+' pool'), + sendto_trait('DeadMap',family+' pool','Eliminate',key('E'), + 'Restore',key('R'),description="Eliminate unit"), mark_trait('Faction',family), basic_trait('','','') ] typs = [d[0] for d in decs] @@ -1974,7 +2152,8 @@ def proto_body(family): stt = enc_parts(*stts) return add_proto(typ,stt) - + + # -------------------------------------------------------------------- def add_splash(root,doc,categories,title='',verbose=False): '''Add an about page @@ -2486,8 +2665,8 @@ def get_picture_info(picture,name,width,height,verbose): return HEX_WIDTH,HEX_HEIGHT,1,1,False,f # Get picture bounding box - pll = picture['lower left'] - pur = picture['upper right'] + tll = picture['lower left'] + tur = picture['upper right'] # Get picture transformation pa = picture['xx'] pb = picture['xy'] @@ -2497,11 +2676,10 @@ def get_picture_info(picture,name,width,height,verbose): pdx = picture['dx'] pdy = picture['dy'] # Define picture global transformation - #pr = lambda x,y: (pa * x + pb * y, pc * x + pd * y) pr = lambda x,y: (pa * x + pc * y, pb * x + pd * y) # Globally transform (rotate) picture bounding box - pll = pr(*pll) - pur = pr(*pur) + pll = pr(*tll) + pur = pr(*tur) # Calculate widht, height, and scaling factors pw = pur[0] - pll[0] ph = pur[1] - pll[1] @@ -3203,6 +3381,16 @@ def create_build(info, centerOnMove = 'Use Preferences Setting', nonOwnerUnmaskable = 'Use Preferences Setting', playerIdFormat = '$playerName$') + # Add global properties + gp = add_globalproperties(root,game) + # Add a turn tracker + tt = add_turntrack(root,game,'Turn',counter={ + 'property': 'Turn', + 'phases': { + 'property': 'Phase', + 'names': sides }}) + add_globalproperty(root,gp,'TurnTracker.defaultDocked',True) + # Add all pieces to the module (including prototypes) gpid = add_counters(root,game,categories, unittypes,echelons,commands,verbose) @@ -3330,7 +3518,9 @@ def create_vmod(vmodname, # Store the name of the image file in catalogue i['filename'] = i['name'].replace(' ','_') + '.png' - vmod.writestr('images/'+i['filename'],i['img']) + imgfn = 'images/'+i['filename'] + if imgfn not in vmod.namelist(): + vmod.writestr(imgfn,i['img']) # Categorize - assume counter typ = i.get('category','counter') -- cgit v1.2.3