diff options
author | Karl Berry <karl@freefriends.org> | 2020-01-15 21:51:17 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2020-01-15 21:51:17 +0000 |
commit | ca06c2adc9964661159bbb5544ebdd1a8d620ac7 (patch) | |
tree | 84e358ba80a3bc8a6d7b9a240e26660fa8ff080a /Master/texmf-dist/tex | |
parent | 14a474d3938a000b58ddd4c440338dc727bdc830 (diff) |
axessibility (15jan20)
git-svn-id: svn://tug.org/texlive/trunk@53416 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex')
-rw-r--r-- | Master/texmf-dist/tex/latex/axessibility/axessibility.sty | 564 |
1 files changed, 564 insertions, 0 deletions
diff --git a/Master/texmf-dist/tex/latex/axessibility/axessibility.sty b/Master/texmf-dist/tex/latex/axessibility/axessibility.sty new file mode 100644 index 00000000000..f90f8f53a70 --- /dev/null +++ b/Master/texmf-dist/tex/latex/axessibility/axessibility.sty @@ -0,0 +1,564 @@ +%% +%% This is file `axessibility.sty', +%% generated with the docstrip utility. +%% +%% The original source files were: +%% +%% axessibility.dtx +%% +%% This is a generated file. +%% +%% Copyright (C) 2018, 2019, 2020 by +%% Anna Capietto, Sandro Coriasco, Boris Doubrov, Alexander Koslovski, +%% Tiziana Armano, Nadir Murru, Dragan Ahmetovic, Cristian Bernareggi +%% +%% Based on accsupp and tagpdf +%% +%% This work consists of the main source files axessibility.dtx and axessibility.lua, +%% and the derived files +%% axessibility.ins, axessibility.sty, axessibility.pdf, README, +%% axessibilityExampleSingleLineT.tex, axessibilityExampleSingleLineA.tex, +%% . axessibilityExampleAlignT.tex, axessibilityExampleAlignA.tex +%% +%% 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 +%% Sandro Coriasco +%% + + + + +\NeedsTeXFormat{LaTeX2e} +\ProvidesPackage{axessibility} + +%% 'tagpdf' or 'accsupp' option +\newif\iftagpdfopt + +\DeclareOption{accsupp}{ + \tagpdfoptfalse +} + +\DeclareOption{tagpdf}{ + \tagpdfopttrue +} + +\ExecuteOptions{tagpdf} + +\ProcessOptions\relax + +\RequirePackage{amsmath} +\RequirePackage{amssymb} +\RequirePackage{xstring} + +%%% +%%% +\makeatletter +\long\def\@macronestedifalign{ +\ifingather@ + \restorealignstate@ + \egroup + \nonumber + \ifnum0=`{\fi\iffalse}\fi + \else + $$% + \fi + } + +\long\def\@macronestedifmultline{ + \iftagsleft@ \@xp\lendmultline@ \else \@xp\rendmultline@ \fi +} +\makeatother + +\iftagpdfopt + %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + % tagpdf option code (default) % + %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + + +\RequirePackage{tagpdf} +\tagpdfsetup{tabsorder=structure,uncompress,activate-all,interwordspace=true} +\tagpdfifpdftexT + { + %set language / can also be done with hyperref + \pdfcatalog{/Lang (en-US)} + \usepackage[T1]{fontenc} + \input glyphtounicode + \pdfgentounicode=1 + } +\tagpdfifluatexT + { + %set language / can also be done with hyperref + \pdfextension catalog{/Lang (en-US)} + \RequirePackage{fontspec} + \RequirePackage{luacode} + \newfontface\zerowidthfont{freeserif} +\directlua{ +require("axessibility.lua") +} +} + + +\makeatletter + +\newtoks\@mltext +\newtoks\@mltexttmp + + + +\newcommand{\doreplacement}[1]{ +\tagpdfifluatexT +\directlua { replace_dls_and_double_dls(#1) } +} + + +\let\begin@document=\document +\let\end@document=\enddocument +\renewcommand{\document}{\begin@document\tagstructbegin{tag=Document}} +\renewcommand{\enddocument}{\tagstructend\end@document} +\makeatother + + +\makeatletter +\newenvironment{temp@env}{% + \relax\ifmmode\@badmath\else$\fi% + \collect@body\wrap}{% + \relax\ifmmode\ifinner$\else\@badmath\fi\else \@badmath\fi} +\protected\def\(#1\){\begin{temp@env}#1\end{temp@env}} +\makeatother + + +\newcommand{\auxiliaryspace}{ } + + +\makeatletter +\long\def\wrap#1{ +\tagstructbegin{tag=P,alttext-o=\detokenize\expandafter{#1}, + actualtext-o=\detokenize\expandafter{#1}} + \tagmcbegin{tag=P,alttext-o=\detokenize\expandafter{#1}, + actualtext-o=\detokenize\expandafter{#1}} + #1 + \tagmcend +\tagstructend +} +\makeatother + + +\makeatletter +\renewenvironment{equation}{% + \incr@eqnum + \mathdisplay@push + \st@rredfalse \global\@eqnswtrue + \mathdisplay{equation}% + \collect@body\wrap\auxiliaryspace}{% + \endmathdisplay{equation}% + \mathdisplay@pop + \ignorespacesafterend +} +\makeatother + + +\makeatletter +\renewenvironment{equation*}{% + \mathdisplay@push + \st@rredtrue \global\@eqnswfalse + \mathdisplay{equation*}% + \collect@body\wrap\auxiliaryspace}{% + \endmathdisplay{equation*}% + \mathdisplay@pop + \ignorespacesafterend +} +\makeatother + + +\makeatletter +\protected\def\[#1\]{\begin{equation*}#1\end{equation*}} +\makeatother + + +\makeatletter + +\long\def\wrapml#1{ +\def\@mltext{\detokenize\expandafter{#1}} +\def\@mltexttmp{} +\StrBehind[6]{\@mltext}{ }[\@mltexttmp] +\StrGobbleRight{\@mltexttmp}{1}[\@mltext] +\tagstructbegin{tag=P,alttext-o=\detokenize\expandafter{\@mltext}, + actualtext-o=\detokenize\expandafter{\@mltext}} + \tagmcbegin{tag=P,alttext-o=\detokenize\expandafter{\@mltext}, + actualtext-o=\detokenize\expandafter{\@mltext}} + #1 +} + +\long\def\wrapmlstar#1{ +\def\@mltext{\detokenize\expandafter{#1}} +\def\@mltexttmp{} +\StrBehind[5]{\@mltext}{ }[\@mltexttmp] +\StrGobbleRight{\@mltexttmp}{1}[\@mltext] +\tagstructbegin{tag=P,alttext-o=\detokenize\expandafter{\@mltext}, + actualtext-o=\detokenize\expandafter{\@mltext}} + \tagmcbegin{tag=P,alttext-o=\detokenize\expandafter{\@mltext}, + actualtext-o=\detokenize\expandafter{\@mltext}} + #1 +} + +\long\def\wrapmlalt#1{ +\def\@mltext{\detokenize\expandafter{#1}} +\def\@mltexttmp{} +\StrBehind[5]{\@mltext}{ }[\@mltexttmp] +\StrGobbleRight{\@mltexttmp}{1}[\@mltext] +\tagstructbegin{tag=P,alttext-o=\detokenize\expandafter{\@mltext}, + actualtext-o=\detokenize\expandafter{\@mltext}} + \tagmcbegin{tag=P,alttext-o=\detokenize\expandafter{\@mltext}, + actualtext-o=\detokenize\expandafter{\@mltext}} + #1 +} + +\makeatother + + +\makeatletter + +\renewenvironment{align}{% + \collect@body\wrapml\auxiliaryspace + \start@align\@ne\st@rredfalse\m@ne +}{% + \math@cr \black@\totwidth@ + \egroup + \@macronestedifalign + \ignorespacesafterend + \tagmcend + \tagstructend +} + +\renewenvironment{align*}{% + \collect@body\wrapmlstar\auxiliaryspace + \start@align\@ne\st@rredtrue\m@ne +}{% + \endalign +} + +\renewenvironment{alignat}{% + \collect@body\wrapml\auxiliaryspace\auxiliaryspace + \start@align\z@\st@rredfalse +}{% + \endalign +} + +\renewenvironment{alignat*}{% + \collect@body\wrapmlstar\auxiliaryspace + \start@align\z@\st@rredtrue +}{% + \endalign +} + +\renewenvironment{xalignat}{% + \collect@body\wrapmlalt\auxiliaryspace + \start@align\@ne\st@rredfalse +}{% + \endalign +} + +\renewenvironment{xalignat*}{% + \collect@body\wrapmlstar\auxiliaryspace + \start@align\@ne\st@rredtrue +}{% + \endalign +} + +\renewenvironment{xxalignat}{% + \collect@body\wrapmlalt\auxiliaryspace + \start@align\tw@\st@rredtrue +}{% + \endalign +} + +\renewenvironment{flalign}{% + \collect@body\wrapml\auxiliaryspace + \start@align\tw@\st@rredfalse\m@ne +}{% + \endalign +} + +\renewenvironment{flalign*}{% + \collect@body\wrapmlstar\auxiliaryspace + \start@align\tw@\st@rredtrue\m@ne +}{% + \endalign +} + +\renewenvironment{gather}{% + \collect@body\wrapmlalt\auxiliaryspace\auxiliaryspace + \start@gather\st@rredfalse +}{% + \math@cr \black@\totwidth@ \egroup + $$\ignorespacesafterend + \tagmcend + \tagstructend +} + +\renewenvironment{gather*}{% + \collect@body\wrapmlstar\auxiliaryspace\auxiliaryspace + \start@gather\st@rredtrue +}{% + \endgather +} + +\renewenvironment{multline}{% + \collect@body\wrapmlalt\auxiliaryspace\auxiliaryspace + \start@multline\st@rredfalse +}{% + \@macronestedifmultline + \ignorespacesafterend + \tagmcend + \tagstructend +} + +\renewenvironment{multline*}{ + \collect@body\wrapmlstar\auxiliaryspace\auxiliaryspace + \start@multline\st@rredtrue +}{ + \endmultline +} + +\makeatother + +%%%% +%%%% + +\else + %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + % accsupp option code % + %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +\RequirePackage{accsupp} + + +\pdfcompresslevel=0 +\pdfoptionpdfminorversion=6 +\input{glyphtounicode} +\pdfgentounicode=1 + + + +\makeatletter + +\newtoks\@mltext +\newtoks\@mltexttmp + +\makeatother + + +\makeatletter +\renewcommand*{\BeginAccSupp}[1]{% + \begingroup + \setkeys{ACCSUPP}{#1}% + \edef\ACCSUPP@span{% + /S/Span<<% + \ifx\ACCSUPP@Lang\relax + \else + /Lang\ACCSUPP@Lang + \fi + \ifx\ACCSUPP@Alt\relax + \else + /Alt\ACCSUPP@Alt + \fi + \ifx\ACCSUPP@ActualText\relax + \else + /ActualText\ACCSUPP@ActualText + \fi + \ifx\ACCSUPP@E\relax + \else + /E\ACCSUPP@E + \fi + >>% + }% + \ACCSUPP@bdc + \ACCSUPP@space + \endgroup +} +\makeatother + + +\newcommand{\auxiliaryspace}{ } + + +\makeatletter +\long\def\wrap#1{ +\BeginAccSupp{method=escape,ActualText=\detokenize\expandafter{#1}} + #1 +\EndAccSupp{}% +} +\makeatother + + +\makeatletter +\long\def\wrapml#1{ +\def\@mltext{\detokenize\expandafter{#1}} +\def\@mltexttmp{} +\StrBehind[5]{\@mltext}{ }[\@mltexttmp] +\StrGobbleRight{\@mltexttmp}{1}[\@mltext] +\BeginAccSupp{method=escape,ActualText=\auxiliaryspace\@mltext} + #1 +\EndAccSupp{}% +} +\makeatother + + +\makeatletter +\renewenvironment{equation}{% + \incr@eqnum + \mathdisplay@push + \st@rredfalse \global\@eqnswtrue + \mathdisplay{equation}% + \collect@body\wrap\auxiliaryspace}{% + \endmathdisplay{equation}% + \mathdisplay@pop + \ignorespacesafterend +} +\makeatother + + +\makeatletter +\renewenvironment{equation*}{% + \mathdisplay@push + \st@rredtrue \global\@eqnswfalse + \mathdisplay{equation*}% + \collect@body\wrap\auxiliaryspace}{% + \endmathdisplay{equation*}% + \mathdisplay@pop + \ignorespacesafterend +} +\makeatother + + +\makeatletter +\protected\def\[#1\]{\begin{equation*}#1\end{equation*}} +\makeatother + + +\makeatletter +\newenvironment{tempenv}{% + \relax\ifmmode\@badmath\else$\fi% + \collect@body\wrap}{% + \relax\ifmmode\ifinner$\else\@badmath\fi\else \@badmath\fi} +\protected\def\(#1\){\begin{tempenv}#1\end{tempenv}} +\makeatother + + +\makeatletter + +\renewenvironment{align}{% + \collect@body\wrapml\auxiliaryspace + \start@align\@ne\st@rredfalse\m@ne +}{% + \math@cr \black@\totwidth@ + \egroup + \@macronestedifalign + \ignorespacesafterend +} + +\renewenvironment{align*}{% + \collect@body\wrapml\auxiliaryspace + \start@align\@ne\st@rredtrue\m@ne +}{% + \endalign +} + +\renewenvironment{alignat}{% + \collect@body\wrapml\auxiliaryspace + \start@align\z@\st@rredfalse +}{% + \endalign +} +\renewenvironment{alignat*}{% + \collect@body\wrapml\auxiliaryspace + \start@align\z@\st@rredtrue +}{% + \endalign +} +\renewenvironment{xalignat}{% + \collect@body\wrapml\auxiliaryspace + \start@align\@ne\st@rredfalse +}{% + \endalign +} +\renewenvironment{xalignat*}{% + \collect@body\wrapml\auxiliaryspace + \start@align\@ne\st@rredtrue +}{% + \endalign +} +\renewenvironment{xxalignat}{% + \collect@body\wrapml\auxiliaryspace + \start@align\tw@\st@rredtrue +}{% + \endalign +} +\renewenvironment{flalign}{% + \collect@body\wrapml\auxiliaryspace + \start@align\tw@\st@rredfalse\m@ne +}{% + \endalign +} + +\renewenvironment{flalign*}{% + \collect@body\wrapml\auxiliaryspace + \start@align\tw@\st@rredtrue\m@ne +}{% + \endalign +} + +\renewenvironment{gather}{% + \collect@body\wrapml\auxiliaryspace\auxiliaryspace + \start@gather\st@rredfalse +}{% + \math@cr \black@\totwidth@ \egroup + $$\ignorespacesafterend +} + +\renewenvironment{gather*}{% + \collect@body\wrapml\auxiliaryspace\auxiliaryspace + \start@gather\st@rredtrue +}{% + \endgather +} + +\renewenvironment{multline}{% + \collect@body\wrapml\auxiliaryspace\auxiliaryspace + \start@multline\st@rredfalse +}{% + %\iftagsleft@ \@xp\lendmultline@ \else \@xp\rendmultline@ \fi + \@macronestedifmultline + \ignorespacesafterend +} + +\renewenvironment{multline*}{ + \collect@body\wrapml\auxiliaryspace\auxiliaryspace + \start@multline\st@rredtrue +}{ + \endmultline +} + +%%} +%% +\makeatother +%%%% +%%%% +\fi + +\endinput +%% +%% End of file `axessibility.sty'. |