summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/algxpar/algxpar.sty
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2020-07-31 21:44:55 +0000
committerKarl Berry <karl@freefriends.org>2020-07-31 21:44:55 +0000
commited1ef8fac34463cec167f47fbf639f3ce741d2d7 (patch)
tree1e6cf640d892bc66c2cf38a45858e064e67c2a13 /Master/texmf-dist/tex/latex/algxpar/algxpar.sty
parent1a5008cd5425e3c9b46a2ccbe936087ed0712181 (diff)
algxpar (31jul20)
git-svn-id: svn://tug.org/texlive/trunk@56006 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/latex/algxpar/algxpar.sty')
-rw-r--r--Master/texmf-dist/tex/latex/algxpar/algxpar.sty102
1 files changed, 71 insertions, 31 deletions
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