[pdftex] Interrobang

Ross Moore ross.moore at mq.edu.au
Mon May 25 00:40:52 CEST 2020


Hello Chris,

On 25 May 2020, at 7:44 am, Chris Moller <moller at mollerware.com<mailto:moller at mollerware.com>> wrote:

My word, what a kiuge!  But it works: docbook2tex to create the .tex file, sed to translate every instance of \Character{8253} into \textinterrobang and then pdfjadetex to turn the modified TeX into a PDF.

That should be totally unnecessary, as you say.

One approach that can be easily implemented is to examine the argument of \Character  first.
If it is  8253  then use  \textinterrobang ,  otherwise let the real expansion of  \Character  take place.

Coding for this is easy:

% save a pointer to the original expansion
\let\realCharacter\Character

% create a macro to compare with
\def\codeofinterrobang{8253}

% define a personalised macro to do what is needed
\def\myCharacter#1{%
 \begingroup
  \def\thiscode{#1}%
  \ifx\thiscode\codeofinterrobang
   \def\next{\endgroup \textinterrobang}%
  \else
   \def\next{\endgroup \realCharacter{#1}}%
  \fi
 \next }%  close group and take the chosen path

%  rebind the system-generated macro to the personalised version
\let\Character\myCharacter


Of course these definitions must come *after* having loaded the coding file
that produces the normal expansion of  \Character .

Using LaTeX, the expansion-capture and rebinding can be delayed
until later, using  \AtBeginDocument .

If there are more character codes that cause problems, the \myCharacter
coding can be extended with a nested  \ifx  for each case.
This could also be done using \ifnum  tests of the code number of the characters.
But there’s no real reason to do it that way, so far as I’m aware.


But it would be cool if someone, someday, tinkered the right code to make the kluge unnecessary.

Give the above a test.

Hope this helps.
Stay safe.

Ross


--cm


On 2020-05-24 16:58, Peter Schmitt wrote:
On Sun, 24 May 2020, Peter Schmitt wrote:

I do not know about this conversion, but since the result is a valid LaTeX file \rlap{?}! should work if you can pass it verbatim (as part of your text) -- the simulation may not be perfect but it should be sufficient.

From the documentation I learned that there is also a
  docbook2tex
If you use this and indicate interrobangs by simply writing this word
(or an abbreviation) in your text than you can search it in the resulting .tex-file and replace by TeX code before using pdf(la)tex on it.
(This procedure could also be automatized by script.)

Peter




Dr Ross Moore
Department of Mathematics and Statistics
12 Wally’s Walk, Level 7, Room 734
Macquarie University, NSW 2109, Australia
T: +61 2 9850 8955  |  F: +61 2 9850 8114
M:+61 407 288 255  |  E: ross.moore at mq.edu.au<mailto:ross.moore at mq.edu.au>
http://www.maths.mq.edu.au
[cid:image001.png at 01D030BE.D37A46F0]
CRICOS Provider Number 00002J. Think before you print.
Please consider the environment before printing this email.

This message is intended for the addressee named and may
contain confidential information. If you are not the intended
recipient, please delete it and notify the sender. Views expressed
in this message are those of the individual sender, and are not
necessarily the views of Macquarie University. <http://mq.edu.au/>
<http://mq.edu.au/>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://tug.org/pipermail/pdftex/attachments/20200524/ddcf6c9a/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image001.png
Type: image/png
Size: 4605 bytes
Desc: image001.png
URL: <https://tug.org/pipermail/pdftex/attachments/20200524/ddcf6c9a/attachment-0001.png>


More information about the pdftex mailing list.