summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/tagpdf/ex-spaceglyph-listings.tex
blob: 3d4f97f6ec9a7e9d2b188099d0a18a057c7f1c6d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
% !Mode:: "TeX:DE:UTF-8:Main"
\DocumentMetadata{uncompress,testphase=phase-I}
\documentclass{article}
\usepackage{amsmath}
\usepackage[ngerman]{babel}
\usepackage{listings}
\makeatletter
%\def\lst@outputspace{\pdffakespace\ } %not so good
% this here works fine with luatex, if the font has a space glyph:
% the pdf then has four space glyphs. But this doesn't mean that they get copied&pasted!
\def\lst@visiblespace{\lst@ttfamily{\char32}{\char32}}
% with pdftex this could work
%\def\lst@visiblespace{\lst@ttfamily{\pdffakespace\ }{\pdffakespace\ }}
\tagpdfsetup{show-spaces,log=v}
\begin{document}\pagestyle{empty}

\begin{lstlisting}[showspaces]
aaa aaa    xxxx
\end{lstlisting}

\end{document}