Skip to content

Commit

Permalink
add \tag_spacechar_on: and \tag_spacechar_off:
Browse files Browse the repository at this point in the history
  • Loading branch information
u-fischer committed Apr 10, 2024
1 parent df25f7c commit d788fe1
Show file tree
Hide file tree
Showing 6 changed files with 1,070 additions and 0 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,11 @@ All notable changes to the `tagpdf` package since the
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
this project uses date-based 'snapshot' version identifiers.

## [Unreleased]
### Added
- \tag_spacechar_on:, \tag_spacechar_off: to locally switch off
the real space chars.

## [2024-03-27]
Version 0.99a
### Fixed
Expand Down
14 changes: 14 additions & 0 deletions doc/tagpdf.tex
Original file line number Diff line number Diff line change
Expand Up @@ -2434,6 +2434,20 @@ \section{\enquote{Real} space glyphs}\label{sec:spacechars}
\pkg{tagpdf} defines this command also for luatex -- attention if can
perhaps insert break points.

\begin{docCommands}
{
{doc name=tag_space_off:}
{doc name=tag_space_on:}
}
\end{docCommand}

The commands allow to switch on and off the insertion of space chars.
With pdftex they map to primitive \cs{pdfinterwordspaceoff} and
and \cs{pdfinterwordspaceon} which insert a whatsits and so act globally.
The luatex implementation uses an attribute which is also set globally to stay
more or less consistent with pdftex. In dvi-mode the commands do nothing.


\section{Structure destinations}\label{sec:struct-dest}

Standard destinations (anchors for internal links) consist of a
Expand Down
60 changes: 60 additions & 0 deletions tagpdf-space.dtx
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,66 @@
\group_end:
}
}
% \end{macrocode}
%
% We need also a command to interrupt the insertion of real space
% chars in places where we want to insert manually special spaces.
% In pdftex this can be done with \cs{pdfinterwordspaceoff}
% and \cs{pdfinterwordspaceon}. These commands insert whatsits
% and this mean they act globally. In luatex a attribute is
% used to this effect, for consistency this is also set globally.
%
%
% \begin{macro}{\tag_spacechar_on:,\tag_spacechar_off:}
% The off command sets the attributes in luatex.
% \begin{macrocode}
\cs_new_protected:Npn \tag_spacechar_off: {}
\cs_new_protected:Npn \tag_spacechar_on: {}

\sys_if_engine_luatex:T
{
\cs_set_protected:Npn \tag_spacechar_off:
{
\lua_now:e
{
tex.setattribute
(
"global",
luatexbase.attributes.g_@@_interwordspaceOff_attr,
1
)
}
}
\cs_set_protected:Npn \tag_spacechar_on:
{
\lua_now:e
{
tex.setattribute
(
"global",
luatexbase.attributes.g_@@_interwordspaceOff_attr,
-2147483647
)
}
}
}
\sys_if_engine_pdftex:T
{
\sys_if_output_pdf:T
{
\cs_set_protected:Npn \tag_spacechar_off:
{
\pdfinterwordspaceoff
}
\cs_set_protected:Npn \tag_spacechar_on:
{
\pdfinterwordspaceon
}
}
}
% \end{macrocode}
% \end{macro}
% \begin{macrocode}
%</package>
% \end{macrocode}
% \end{macro}
Expand Down
Loading

0 comments on commit d788fe1

Please sign in to comment.