Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions pdfpc/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@ console (pdfpc) program.
[`kvoptions`](https://ctan.org/pkg/kvoptions),
[`xstring`](https://ctan.org/pkg/xstring),
[`iftex`](https://ctan.org/pkg/iftex),
[`hyperxmp`](https://ctan.org/pkg/hyperxmp)
[`hyperxmp`](https://ctan.org/pkg/hyperxmp),
[`stringenc`](https://ctan.org/pkg/stringenc)

When using LuaTeX, it additionally depends on these packages:
[`stringenc`](https://ctan.org/pkg/stringenc),
When using LuaTeX, it additionally depends on these package
[`pdftexcmds`](https://ctan.org/pkg/pdftexcmds)

## Usage
Expand Down
5 changes: 3 additions & 2 deletions pdfpc/pdfpc-doc.tex
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,9 @@ \section*{Dependencies and other requirements}

It depends on the following packages:

\begin{multicols}{4}\sffamily\centering
kvoptions \\ xstring \\ iftex \\ hyperxmp
\begin{multicols}{3}\sffamily\centering
kvoptions \\ xstring \\ iftex \\ hyperxmp \\ stringenc \\
pdftexcmds\footnote{Only when using Lua\LaTeX}
\end{multicols}

\section*{License}
Expand Down
32 changes: 29 additions & 3 deletions pdfpc/pdfpc.sty
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@
\RequirePackage{xstring}
\RequirePackage{iftex}
\RequirePackage{hyperxmp}
\RequirePackage{stringenc}
\ifLuaTeX
\RequirePackage{stringenc}
\RequirePackage{pdftexcmds}
\fi
%
Expand Down Expand Up @@ -169,16 +169,42 @@ ______</rdf:Description>^^J%
\relax%
}%
\else%
\def\pdfpc@hexnewlines#1#2#3#4#5\pdfpc@@end{%
\if\relax\detokenize{#5}\relax
#1#2#3#4%
\else
\ifnum"#1#2#3#4="005C
\pdfpc@hexnewlines@afterbs#5\pdfpc@@end
\else
#1#2#3#4\pdfpc@hexnewlines#5\pdfpc@@end
\fi
\fi
}
\def\pdfpc@hexnewlines@afterbs#1#2#3#4#5\pdfpc@@end{%
\if\relax\detokenize{#5}\relax
\ifnum"#1#2#3#4="005C
000A%
\else
005C#1#2#3#4%
\fi
\else
\ifnum"#1#2#3#4="005C
000A\pdfpc@hexnewlines#5\pdfpc@@end
\else
005C#1#2#3#4\pdfpc@hexnewlines#5\pdfpc@@end
\fi
\fi
}
\ifLuaTeX%
\protected\def\pdfannot {\pdfextension annot }%
\newcommand{\pdfpcnote}[1]{%
\edef\tmp@a{\pdf@escapehexnative{#1}}
\expandafter\SE@ConvertFrom\expandafter\tmp@a\expandafter{\tmp@a}{utf8}
\edef\tmp@a{FEFF\tmp@a}
{%
\edef\\{\string\n}%
\pdfannot width 0pt height 0pt depth 0pt {%
/Subtype /Text%
/Contents <FEFF\tmp@a>%
/Contents <\expandafter\pdfpc@hexnewlines\tmp@a\pdfpc@@end>%
/F 6%
}%
}%
Expand Down