[latex3-commits] [git/LaTeX3-latex3-pdfresources] backendtest: more work on the docu (fb89d1f)

Ulrike Fischer fischer at troubleshooting-tex.de
Fri Aug 23 12:31:49 CEST 2019


Repository : https://github.com/latex3/pdfresources
On branch  : backendtest
Link       : https://github.com/latex3/pdfresources/commit/fb89d1f62410ec52266a29e4c867eb87f2f5d083

>---------------------------------------------------------------

commit fb89d1f62410ec52266a29e4c867eb87f2f5d083
Author: Ulrike Fischer <fischer at troubleshooting-tex.de>
Date:   Fri Aug 23 12:31:49 2019 +0200

    more work on the docu


>---------------------------------------------------------------

fb89d1f62410ec52266a29e4c867eb87f2f5d083
 pdfresources.dtx | 81 +++++++++++++++++++++++++++++++++-----------------------
 1 file changed, 48 insertions(+), 33 deletions(-)

diff --git a/pdfresources.dtx b/pdfresources.dtx
index 3a99f38..856c3e1 100644
--- a/pdfresources.dtx
+++ b/pdfresources.dtx
@@ -25,6 +25,7 @@
 %<*driver>
 \documentclass{l3doc}
 \usepackage{tabularx,array,booktabs}
+\newcommand\potentialclash{\noindent\llap{\dbend\ }}
 \begin{document}
   \DocInput{\jobname.dtx}
 \end{document}
@@ -284,7 +285,7 @@
 %  but it should be done by subtrees ...
 %  \end{NOTE}
 %
-%  Currently the following names are used:
+%  Currently the following names are used: %check, compare with \@@_prop_names_seq
 %  \begin{verbatim}
 %  /Pages           %w,  \pagesattr
 %  /PageN           %w, N=1,..n or empty (=all pages) \pageattr
@@ -317,8 +318,7 @@
   }
 %    \end{macrocode}
 %  \end{macro}
-
-
+%
 %  \begin{macro}{\@@_prop_gclear,
 %                \@@_prop_gput:n,
 %                \@@_prop_get:nnN,
@@ -359,17 +359,18 @@
 
 %    \end{macrocode}
 % \end{macro}
+%
 % \begin{macro}{ \@@_prop_map_dict_item:n }
 % \cs{@@_prop_map_dict_item:n} outputs a prop as needed in a dictionary:
 %  a list of /\meta{key} \meta{value} pairs.
 %    \begin{macrocode}
 \cs_new:Npn \@@_prop_map_dict_item:n #1 %path
- {
-   \prop_map_function:cN { \@@_prop_name:n {#1}} \@@_dict_item:nn
- }
+  {
+    \prop_map_function:cN { \@@_prop_name:n {#1}} \@@_dict_item:nn
+  }
 %    \end{macrocode}
 % \end{macro}
-
+%
 % \begin{macro}{ \@@_prop_merge:nnN }
 % \cs{@@_prop_merge:nnN} merges at first the property \meta{name_1}
 %  then optionally \meta{name_2} into property |#3|.
@@ -387,6 +388,7 @@
   }
 %    \end{macrocode}
 % \end{macro}
+%
 % \section{Resources management}
 % \subsection{pdfpagesattr}
 % \subsubsection{pdfpagesattr/backend}
@@ -397,41 +399,48 @@
 %  dvipdfmx syntax: \verb+\special{pdf:put @pages <</ABC /WEZ /EFG /XYZ /Rotate 0>>}+
 %  both remove duplicate entries automatically, so there is no need to be careful.
 % \end{NOTE}
+% \begin{macro}{\@@_backend_Pages_primitive:n}
+% This is the primitive command to add something to the /Pages dictionary.
+% It works differently for the backends: pdftex and luatex overwrite existing
+% content, dvips and dvipdfmx are additive. luatex sets it in lua.
+% The higher level code has to take this into account.
 %    \begin{macrocode}
 %pdftex
 \bool_if:nT {\sys_if_engine_pdftex_p: && \sys_if_output_pdf_p:}
-{
- \cs_new_protected:Npn \@@_backend_Pages_primitive:n #1
   {
-    \tex_global:D \tex_pdfpagesattr:D {#1}
+    \cs_new_protected:Npn \@@_backend_Pages_primitive:n #1
+      {
+        \tex_global:D \tex_pdfpagesattr:D {#1}
+      }
   }
-}
-%luatex
+%luatex: does it in lua
 \sys_if_engine_luatex:T
- {
-  \cs_new_protected:Npn \@@_backend_Pages_primitive:n #1
-   {
-     \tex_directlua:D {pdf.setpagesattributes(\@@_backend_luastring:n {#1})}
-   }
- }
+  {
+    \cs_new_protected:Npn \@@_backend_Pages_primitive:n #1
+      {
+        \tex_directlua:D {pdf.setpagesattributes(\@@_backend_luastring:n {#1})}
+      }
+  }
 %dvips
 \bool_if:nT {\sys_if_engine_pdftex_p: && !\sys_if_output_pdf_p: }
-{
- \cs_new_protected:Npx \@@_backend_Pages_primitive:n #1
   {
-    \tex_special:D{ps:~[#1~/PAGES~pdfmark} %]
+    \cs_new_protected:Npx \@@_backend_Pages_primitive:n #1
+      {
+        \tex_special:D{ps:~[#1~/PAGES~pdfmark} %]
+      }
   }
-}
 
 %xetex
 \sys_if_engine_xetex:T
- {
-  \cs_new_protected:Npn \@@_backend_Pages_primitive:n #1
-   {
-    \@@_backend:n{put~@pages~<<#1>>}
-   }
- }
+  {
+    \cs_new_protected:Npn \@@_backend_Pages_primitive:n #1
+      {
+        \@@_backend:n{put~@pages~<<#1>>}
+      }
+  }
 %    \end{macrocode}
+% \end{macro}
+%
 % \subsubsection{pdfpagesattr/management}
 % \begin{NOTE}{UF}
 % The register is normally used only a few times in a document, so it would be
@@ -446,11 +455,16 @@
 %   \end{syntax}
 %   Adds |/|\meta{name} \meta{value} to the |/Pages| dictionary.
 %   It is always stored globally. The content is written to the pdf
-%   at the end of the compilation, so values can be added, changed or removed until then.
+%   at the end of the compilation, so values can be added, changed or
+%   removed until then.
 %   \meta{name} should be a valid pdf name without the leading slash,
-%   \meta{value} should be a valid pdf value. Any escaping or (re)encoding must be
-%   done explictly. If a \meta{name} is used twice, only the last \meta{value}
+%   \meta{value} should be a valid pdf value. Any escaping or (re)encoding must
+%   be done explictly. If a \meta{name} is used twice, only the last \meta{value}
 %   set will be used.
+%
+%   \potentialclash As the content is written at the end it will
+%   in pdftex and luatex overwrite values added with the primitive commands.
+%   Package authors should use the management commands instead.
 % \end{function}
 % \begin{function}[added = 2019-06-04]
 %   {\pdf_pagesattr_get:nN}
@@ -471,8 +485,9 @@
 %   \begin{syntax}
 %     \cs{pdf_pagesattr_gremove:n} \Arg{name}
 %   \end{syntax}
-%   Removes  |/|\meta{name} and its associated \meta{value} from the |/Pages| dictionary
-%   (if the name-value pair has been added by  \cs{pdf_pagesattr_gput:nn}).
+%   Removes  |/|\meta{name} and its associated \meta{value} from the |/Pages|
+%   dictionary (if the name-value pair has been added by
+%   \cs{pdf_pagesattr_gput:nn}).
 %   If \meta{name} is not found no change occurs,
 %   \emph{i.e}~there is no need to test for the existence of a name before
 %   trying to remove it.





More information about the latex3-commits mailing list