[pdftex] Interrobang
Chris Moller
moller at mollerware.com
Mon May 25 05:12:59 CEST 2020
Except that it's something way down deep in the docbook processing that
produces the \Character{...} code and if I tinker with that it would
basically become my own private docbook fork. As bad as the sed kluge
is, at least I can bury it in a Makefile and maybe no one will notice.
On 2020-05-24 18:40, Ross Moore wrote:
> 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
>
> CRICOS Provider Number 00002J. Think before youprint.
> Please consider the environment before printing thisemail.
>
> This message is intended for the addressee namedand may
> contain confidential information. If you are not theintended
> recipient, please delete it and notify the sender. Viewsexpressed
> in this message are those of the individual sender, andare not
> necessarily the views of Macquarie University. <http://mq.edu.au/>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://tug.org/pipermail/pdftex/attachments/20200524/4807fdea/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image001.png
Type: image/png
Size: 4605 bytes
Desc: not available
URL: <https://tug.org/pipermail/pdftex/attachments/20200524/4807fdea/attachment-0001.png>
More information about the pdftex
mailing list.