From ed1ef8fac34463cec167f47fbf639f3ce741d2d7 Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Fri, 31 Jul 2020 21:44:55 +0000 Subject: algxpar (31jul20) git-svn-id: svn://tug.org/texlive/trunk@56006 c570f23f-e606-0410-a88d-b1316a301751 --- Master/texmf-dist/tex/latex/algxpar/algxpar.sty | 102 +++++++++++++++++------- 1 file changed, 71 insertions(+), 31 deletions(-) (limited to 'Master/texmf-dist/tex/latex/algxpar') diff --git a/Master/texmf-dist/tex/latex/algxpar/algxpar.sty b/Master/texmf-dist/tex/latex/algxpar/algxpar.sty index 93194e6ecbc..1ed25143b1c 100644 --- a/Master/texmf-dist/tex/latex/algxpar/algxpar.sty +++ b/Master/texmf-dist/tex/latex/algxpar/algxpar.sty @@ -1,17 +1,6 @@ -%% -%% This is file `algxpar.sty', -%% generated with the docstrip utility. -%% -%% The original source files were: -%% -%% algxpar.dtx (with options: `algxpar') -%% -%% -%% Copyright (C) 2019 by Jander Moreira (moreira.jander@gmail.com) -%% \NeedsTeXFormat{LaTeX2e}[2005/12/01] \ProvidesPackage{algxpar} -[2019/10/24 v0.9 Algorithms with multiline/paragraph support] +[2020/05/30 v0.91 Algorithms with multiline/paragraph support] %% Package options \newif\ifaxp@brazilian\axp@brazilianfalse @@ -30,13 +19,13 @@ \RequirePackage{fancyvrb} % to load verbatim preserving tabs %% Constants and identifiers -\algnewcommand\algorithmictrue{\textsc{True}} -\algnewcommand\algorithmicfalse{\textsc{False}} -\algnewcommand\algorithmicnil{\textsc{Nil}} -\algnewcommand\True{\mbox{\algorithmictrue}} -\algnewcommand\False{\mbox{\algorithmicfalse}} -\algnewcommand\Nil{\mbox{\algorithmicnil}} -\newcommand{\Id}[1]{\mbox{\textit{\rmfamily #1}}} +\algnewcommand\algorithmictrue{True} +\algnewcommand\algorithmicfalse{False} +\algnewcommand\algorithmicnil{Nil} +\algnewcommand\True{\ensuremath{\textsc{\rmfamily \algorithmictrue}}} +\algnewcommand\False{\ensuremath{\textsc{\rmfamily \algorithmicfalse}}} +\algnewcommand\Nil{\ensuremath{\textsc{\rmfamily \algorithmicnil}}} +\newcommand{\Id}[1]{\ensuremath{\textit{\rmfamily#1}}} \newcommand{\TextString}[1]{\textrm{\normalfont``{\ttfamily\mbox{#1}}''}} \algnewcommand{\VisibleSpace}{\textrm{\color{black!70}\textvisiblespace}} @@ -55,6 +44,10 @@ %% Read, write \algnewcommand{\algorithmicread}{\textbf{read}} \algnewcommand{\algorithmicwrite}{\textbf{write}} +\algnewcommand\algorithmicset{Set} +\algnewcommand\algorithmicsetto{to} +\algnewcommand{\Set}[2]{\Id{#1} $\gets$ #2} +\algnewcommand{\Setl}[2]{\algorithmicset\ #1 \algorithmicsetto\ #2} \algnewcommand{\Read}{\algorithmicread} \algnewcommand{\Write}{\algorithmicwrite} @@ -81,7 +74,7 @@ \algblockdefx{While}{EndWhile}% [2][]{% \settowidth{\axp@whilewidth}{\algorithmicwhile\ }% -\algparbox[#1]{\algorithmicwhile\ #2~\algorithmicdo}{\axp@whilewidth}% +\algparbox[x#1]{\algorithmicwhile\ #2~\algorithmicdo}{\axp@whilewidth}% }% {\algorithmicend\ \algorithmicwhile} @@ -208,7 +201,7 @@ {\jobname_code_#2.tmp}}} \algrenewcommand{\alglinenumber}[1]% - {\hspace{-1em}\color{black!35}{\scriptsize#1}{\tiny$\blacktriangleright$}} + {\hspace{-1.5em}\color{black!35}{\scriptsize#1}\raisebox{0.2ex}{\tiny$\blacktriangleright$}} %% axp@algparbox \newlength{\axp@commentwidth} @@ -260,8 +253,19 @@ literate= {ñ}{{\~n}}1 {Ñ}{{\~N}}1 {¿}{{?`}}1 } -\ifaxp@brazilian -\RequirePackage{icomma} % comma as decimal separator +\pgfkeys{ +algxpar/.cd, +brazilian/.code = {\axp@languagebrazilian}, +english/.code = {\axp@languageenglish}, +default/.code = {\axp@languageenglish}, +} +\newcommand{\algxparset}[1]{ +\pgfkeys{ +algxpar/.cd, +#1 +} +} +\newcommand{\axp@languagebrazilian}{ \algrenewcommand\algorithmicdescription{\textbf{Descrição}} \algrenewcommand\algorithmicinput{\textbf{Entrada}} \algrenewcommand\algorithmicoutput{\textbf{Saída}} @@ -278,7 +282,6 @@ literate= \algrenewcommand{\algorithmicfor}{\textbf{para}} \algrenewcommand{\algorithmicdo}{\textbf{faça}} \algrenewcommand{\algorithmicwhile}{\textbf{enquanto}} -\algrenewcommand{\algorithmicforall}{\textbf{para cada}} \algrenewcommand{\algorithmicrepeat}{\textbf{repita}} \algrenewcommand{\algorithmicuntil}{\textbf{até que}} \algrenewcommand{\algorithmicloop}{\textbf{repita}} @@ -287,15 +290,52 @@ literate= \algrenewcommand{\algorithmicfunction}{\textbf{função}} \algrenewcommand{\algorithmicprocedure}{\textbf{procedimento}} \algrenewcommand{\algorithmicreturn}{\textbf{retorne}} -\algrenewcommand\algorithmictrue{\textsc{Verdadeiro}} -\algrenewcommand\algorithmicfalse{\textsc{Falso}} -\algrenewcommand\algorithmicnil{\textsc{Nulo}} +\algrenewcommand{\algorithmictrue}{Verdadeiro} +\algrenewcommand{\algorithmicfalse}{Falso} +\algrenewcommand{\algorithmicnil}{Nulo} \algrenewcommand{\algorithmicread}{\textbf{leia}} \algrenewcommand{\algorithmicwrite}{\textbf{escreva}} +\algrenewcommand{\algorithmicset}{Defina} +\algrenewcommand{\algorithmicsetto}{como} \algrenewcommand{\To}{\textbf{até}} \algrenewcommand{\DownTo}{\textbf{decrescente~até}} \algrenewcommand{\Step}{\textbf{passo}} -\fi -\endinput -%% -%% End of file `algxpar.sty'. +} +\newcommand{\axp@languageenglish}{ +\algrenewcommand\algorithmicdescription{\textbf{Description}} +\algrenewcommand\algorithmicinput{\textbf{Input}} +\algrenewcommand\algorithmicoutput{\textbf{Output}} +\algrenewcommand\algorithmicrequire{\textbf{Pre}} +\algrenewcommand\algorithmicensure{\textbf{Post}} +\algrenewcommand{\algorithmicend}{\textbf{end}} +\algrenewcommand{\algorithmicif}{\textbf{if}} +\algrenewcommand{\algorithmicthen}{\textbf{then}} +\algrenewcommand{\algorithmicelse}{\textbf{else}} +\algrenewcommand{\algorithmicswitch}{\textbf{swith}} +\algrenewcommand{\algorithmicof}{\textbf{of}} +\algrenewcommand{\algorithmiccase}{\textbf{case}} +\algrenewcommand{\algorithmicotherwise}{\textbf{otherwise}} +\algrenewcommand{\algorithmicfor}{\textbf{for}} +\algrenewcommand{\algorithmicdo}{\textbf{do}} +\algrenewcommand{\algorithmicwhile}{\textbf{while}} +\algrenewcommand{\algorithmicrepeat}{\textbf{repeat}} +\algrenewcommand{\algorithmicuntil}{\textbf{until}} +\algrenewcommand{\algorithmicloop}{\textbf{loop}} +\algrenewcommand{\algorithmicforeach}{\textbf{for~each}} +\algrenewcommand{\algorithmicforall}{\textbf{for~all}} +\algrenewcommand{\algorithmicfunction}{\textbf{function}} +\algrenewcommand{\algorithmicprocedure}{\textbf{procedure}} +\algrenewcommand{\algorithmicreturn}{\textbf{retorne}} +\algrenewcommand{\algorithmictrue}{True} +\algrenewcommand{\algorithmicfalse}{False} +\algrenewcommand{\algorithmicnil}{Nil} +\algrenewcommand{\algorithmicread}{\textbf{read}} +\algrenewcommand{\algorithmicwrite}{\textbf{write}} +\algrenewcommand{\algorithmicset}{Set} +\algrenewcommand{\algorithmicsetto}{to} +\algrenewcommand{\To}{\textbf{to}} +\algrenewcommand{\DownTo}{\textbf{downto}} +\algrenewcommand{\Step}{\textbf{step}} +} +\axp@languageenglish % default language +\ifaxp@brazilian\algxparset{brazilian}\fi -- cgit v1.2.3