Discussion:
[XeTeX] Fake italics for some characters only
Benct Philip Jonsson
2018-12-04 19:57:42 UTC
Permalink
I have a somewhat unusual problem. In a document produced using
XeLaTeX I need to use four Unicode letters with scarce font
support in italicized words and passages but the font which I have
to use supports these characters only in roman. The obvious
solution is to use the FakeSlant feature of fontspec but I don’t
want to enclose these characters in a command argument, in the
hope that a future version of the document can use an italic font
which supports these characters, but neither do I (perhaps
needless to say) want to use fake italics except for these four
characters. In other words I would like to perform some kind of
“keyhole surgery” in the preamble and use these characters
normally in the body of the document, which I guess means having
to make them active and somehow detect when they are inside the
argument of `\textit`. (Note: it is appropriate to use `\textit`
rather than `\emph` here because the purpose of the italicization
is to mark text as being in an object language in a linguistic
text.) Is that at all possible? I guess I could wrap `\textit` in
a macro which locally redefines the active characters, but I’m not
sure how to do that, nor how to access the glyphs corresponding to
the characters once the characters are active. I am a user who
isn’t afraid of using and making the most of various packages or
of writing an occasional custom command to wrap up some repeatedly
needed operation, but I am no expert. I am aware of all the
arguments against fake italics — that is why I want to limit the
damage as much as possible! — but I have no choice here. Waiting
for the/an appropriate font to include italic versions of these
characters is not an option at the moment.

/Benct



--------------------------------------------------
Subscriptions, Archive, and List information, etc.:
http://tug.org/mail
Alan Munn
2018-12-05 03:51:57 UTC
Permalink
Can you provide a bit more detail? Maybe a small example document?

Alan


Benct Philip Jonsson wrote:
> I have a somewhat unusual problem. In a document produced using
> XeLaTeX I need to use four Unicode letters with scarce font support in
> italicized words and passages but the font which I have to use
> supports these characters only in roman. The obvious solution is to
> use the FakeSlant feature of fontspec but I don’t want to enclose
> these characters in a command argument, in the hope that a future
> version of the document can use an italic font which supports these
> characters, but neither do I (perhaps needless to say) want to use
> fake italics except for these four characters. In other words I would
> like to perform some kind of “keyhole surgery” in the preamble and use
> these characters normally in the body of the document, which I guess
> means having to make them active and somehow detect when they are
> inside the argument of `\textit`. (Note: it is appropriate to use
> `\textit` rather than `\emph` here because the purpose of the
> italicization is to mark text as being in an object language in a
> linguistic text.) Is that at all possible? I guess I could wrap
> `\textit` in a macro which locally redefines the active characters,
> but I’m not sure how to do that, nor how to access the glyphs
> corresponding to the characters once the characters are active. I am a
> user who isn’t afraid of using and making the most of various packages
> or of writing an occasional custom command to wrap up some repeatedly
> needed operation, but I am no expert. I am aware of all the arguments
> against fake italics — that is why I want to limit the damage as much
> as possible! — but I have no choice here. Waiting for the/an
> appropriate font to include italic versions of these characters is not
> an option at the moment.
>
> /Benct
>
>
>
> --------------------------------------------------
> Subscriptions, Archive, and List information, etc.:
> http://tug.org/mailman/listinfo/xetex



--------------------------------------------------
Subscriptions, Archive, and List information, e
Zdenek Wagner
2018-12-05 09:50:35 UTC
Permalink
Hi,

I am afraid that I do not understand why to make only 4 FakeSlant
characters instead of a FakeSlant font. Does it mean that other
characters will remain upright inside \textit?

Anyway, making a few characters active for \textit is quite simple.
Let's suppose that A and B should be active. You then define:

\def\mytextit{\begingroup \catcode`\A=13 \catcode`\B=13 \dotextit}
\def\dotextit#1{\textit{#1}\endgroup}

You will then call \mytextit{Test of A and B}

Zdeněk Wagner
http://ttsm.icpf.cas.cz/team/wagner.shtml
http://icebearsoft.euweb.cz

st 5. 12. 2018 v 5:51 odesílatel Alan Munn <***@gmx.com> napsal:
>
> Can you provide a bit more detail? Maybe a small example document?
>
> Alan
>
>
> Benct Philip Jonsson wrote:
> > I have a somewhat unusual problem. In a document produced using
> > XeLaTeX I need to use four Unicode letters with scarce font support in
> > italicized words and passages but the font which I have to use
> > supports these characters only in roman. The obvious solution is to
> > use the FakeSlant feature of fontspec but I don’t want to enclose
> > these characters in a command argument, in the hope that a future
> > version of the document can use an italic font which supports these
> > characters, but neither do I (perhaps needless to say) want to use
> > fake italics except for these four characters. In other words I would
> > like to perform some kind of “keyhole surgery” in the preamble and use
> > these characters normally in the body of the document, which I guess
> > means having to make them active and somehow detect when they are
> > inside the argument of `\textit`. (Note: it is appropriate to use
> > `\textit` rather than `\emph` here because the purpose of the
> > italicization is to mark text as being in an object language in a
> > linguistic text.) Is that at all possible? I guess I could wrap
> > `\textit` in a macro which locally redefines the active characters,
> > but I’m not sure how to do that, nor how to access the glyphs
> > corresponding to the characters once the characters are active. I am a
> > user who isn’t afraid of using and making the most of various packages
> > or of writing an occasional custom command to wrap up some repeatedly
> > needed operation, but I am no expert. I am aware of all the arguments
> > against fake italics — that is why I want to limit the damage as much
> > as possible! — but I have no choice here. Waiting for the/an
> > appropriate font to include italic versions of these characters is not
> > an option at the moment.
> >
> > /Benct
> >
> >
> >
> > --------------------------------------------------
> > Subscriptions, Archive, and List information, etc.:
> > http://tug.org/mailman/listinfo/xetex
>
>
>
> --------------------------------------------------
> Subscriptions, Archive, and List information, etc.:
> http://tug.org/mailman/listinfo/xetex



--------------------------------------------------
Subscriptions, Archive, and List information, etc.:
http://tug.org/mai
BPJ
2018-12-05 10:41:57 UTC
Permalink
@Zdenek, the point is that other characters inside `\textit` should be real
italics. I at least have tried it using a macro around the "culprit"
characters and I think it looks better than fake italics throughout, which
looks really bad (shades of low-budget publications from the early
eighties! :-). Anyway I'm working on a solution in my head which I'll try
when I get back to my desktop. I think I'll try to use a boolean which I
set/unset at the start/end of my "`\mytextit` and a single macro for the
active characters which checks this boolean. I have no idea yet if it will
work, but it seems the semantically cleanest way to do it to my mind.

/bpj

ons 5 dec. 2018 kl. 10:53 skrev Zdenek Wagner <***@gmail.com>:

> Hi,
>
> I am afraid that I do not understand why to make only 4 FakeSlant
> characters instead of a FakeSlant font. Does it mean that other
> characters will remain upright inside \textit?
>
> Anyway, making a few characters active for \textit is quite simple.
> Let's suppose that A and B should be active. You then define:
>
> \def\mytextit{\begingroup \catcode`\A=13 \catcode`\B=13 \dotextit}
> \def\dotextit#1{\textit{#1}\endgroup}
>
> You will then call \mytextit{Test of A and B}
>
> Zdeněk Wagner
> http://ttsm.icpf.cas.cz/team/wagner.shtml
> http://icebearsoft.euweb.cz
>
> st 5. 12. 2018 v 5:51 odesílatel Alan Munn <***@gmx.com> napsal:
> >
> > Can you provide a bit more detail? Maybe a small example document?
> >
> > Alan
> >
> >
> > Benct Philip Jonsson wrote:
> > > I have a somewhat unusual problem. In a document produced using
> > > XeLaTeX I need to use four Unicode letters with scarce font support in
> > > italicized words and passages but the font which I have to use
> > > supports these characters only in roman. The obvious solution is to
> > > use the FakeSlant feature of fontspec but I don’t want to enclose
> > > these characters in a command argument, in the hope that a future
> > > version of the document can use an italic font which supports these
> > > characters, but neither do I (perhaps needless to say) want to use
> > > fake italics except for these four characters. In other words I would
> > > like to perform some kind of “keyhole surgery” in the preamble and use
> > > these characters normally in the body of the document, which I guess
> > > means having to make them active and somehow detect when they are
> > > inside the argument of `\textit`. (Note: it is appropriate to use
> > > `\textit` rather than `\emph` here because the purpose of the
> > > italicization is to mark text as being in an object language in a
> > > linguistic text.) Is that at all possible? I guess I could wrap
> > > `\textit` in a macro which locally redefines the active characters,
> > > but I’m not sure how to do that, nor how to access the glyphs
> > > corresponding to the characters once the characters are active. I am a
> > > user who isn’t afraid of using and making the most of various packages
> > > or of writing an occasional custom command to wrap up some repeatedly
> > > needed operation, but I am no expert. I am aware of all the arguments
> > > against fake italics — that is why I want to limit the damage as much
> > > as possible! — but I have no choice here. Waiting for the/an
> > > appropriate font to include italic versions of these characters is not
> > > an option at the moment.
> > >
> > > /Benct
> > >
> > >
> > >
> > > --------------------------------------------------
> > > Subscriptions, Archive, and List information, etc.:
> > > http://tug.org/mailman/listinfo/xetex
> >
> >
> >
> > --------------------------------------------------
> > Subscriptions, Archive, and List information, etc.:
> > http://tug.org/mailman/listinfo/xetex
>
>
>
> --------------------------------------------------
> Subscriptions, Archive, and List information, etc.:
> http://tug.org/mailman/listinfo/xetex
>
Ross Moore
2018-12-05 11:48:03 UTC
Permalink
BPJ and John Was,

Please join this XeTeX list.
Otherwise I have to authorize each of your postings.
This delays them being sent out to everyone.


Cheers.

Ross

On 05/12/2018, at 22:10, "BPJ" <***@melroch.se<mailto:***@melroch.se>> wrote:

@Zdenek, the point is that other characters inside `\textit` should be real italics. I at least have tried it using a macro around the "culprit" characters and I think it looks better than fake italics throughout, which looks really bad (shades of low-budget publications from the early eighties! :-). Anyway I'm working on a solution in my head which I'll try when I get back to my desktop. I think I'll try to use a boolean which I set/unset at the start/end of my "`\mytextit` and a single macro for the active characters which checks this boolean. I have no idea yet if it will work, but it seems the semantically cleanest way to do it to my mind.

/bpj

ons 5 dec. 2018 kl. 10:53 skrev Zdenek Wagner <***@gmail.com<mailto:***@gmail.com>>:
Hi,

I am afraid that I do not understand why to make only 4 FakeSlant
characters instead of a FakeSlant font. Does it mean that other
characters will remain upright inside \textit?

Anyway, making a few characters active for \textit is quite simple.
Let's suppose that A and B should be active. You then define:

\def\mytextit{\begingroup \catcode`\A=13 \catcode`\B=13 \dotextit}
\def\dotextit#1{\textit{#1}\endgroup}

You will then call \mytextit{Test of A and B}

Zdeněk Wagner
http://ttsm.icpf.cas.cz/team/wagner.shtml<https://protect-au.mimecast.com/s/h-AwCmO5wZspw2y0cG3L-o?domain=ttsm.icpf.cas.cz>
http://icebearsoft.euweb.cz<https://protect-au.mimecast.com/s/DS_NCnx1Z5UX059yFJk5eW?domain=icebearsoft.euweb.cz>

st 5. 12. 2018 v 5:51 odesílatel Alan Munn <***@gmx.com<mailto:***@gmx.com>> napsal:
>
> Can you provide a bit more detail? Maybe a small example document?
>
> Alan
>
>
> Benct Philip Jonsson wrote:
> > I have a somewhat unusual problem. In a document produced using
> > XeLaTeX I need to use four Unicode letters with scarce font support in
> > italicized words and passages but the font which I have to use
> > supports these characters only in roman. The obvious solution is to
> > use the FakeSlant feature of fontspec but I don’t want to enclose
> > these characters in a command argument, in the hope that a future
> > version of the document can use an italic font which supports these
> > characters, but neither do I (perhaps needless to say) want to use
> > fake italics except for these four characters. In other words I would
> > like to perform some kind of “keyhole surgery” in the preamble and use
> > these characters normally in the body of the document, which I guess
> > means having to make them active and somehow detect when they are
> > inside the argument of `\textit`. (Note: it is appropriate to use
> > `\textit` rather than `\emph` here because the purpose of the
> > italicization is to mark text as being in an object language in a
> > linguistic text.) Is that at all possible? I guess I could wrap
> > `\textit` in a macro which locally redefines the active characters,
> > but I’m not sure how to do that, nor how to access the glyphs
> > corresponding to the characters once the characters are active. I am a
> > user who isn’t afraid of using and making the most of various packages
> > or of writing an occasional custom command to wrap up some repeatedly
> > needed operation, but I am no expert. I am aware of all the arguments
> > against fake italics — that is why I want to limit the damage as much
> > as possible! — but I have no choice here. Waiting for the/an
> > appropriate font to include italic versions of these characters is not
> > an option at the moment.
> >
> > /Benct
> >
> >
> >
> > --------------------------------------------------
> > Subscriptions, Archive, and List information, etc.:
> > http://tug.org/mailman/listinfo/xetex<https://protect-au.mimecast.com/s/kD-7CoV1Y2SDN42oTVDIZs?domain=tug.org>
>
>
>
> --------------------------------------------------
> Subscriptions, Archive, and List information, etc.:
> http://tug.org/mailman/listinfo/xetex<https://protect-au.mimecast.com/s/kD-7CoV1Y2SDN42oTVDIZs?domain=tug.org>



--------------------------------------------------
Subscriptions, Archive, and List information, etc.:
http://tug.org/mailman/listinfo/xetex<https://protect-au.mimecast.com/s/kD-7CoV1Y2SDN42oTVDIZs?domain=tug.org>


--------------------------------------------------
Subscriptions, Archive, and List information, etc.:
https://protect-au.mimecast.com/s/kD-7CoV1Y2SDN42oTVDIZs?domain=tug.org
Benct Philip Jonsson
2018-12-05 16:19:37 UTC
Permalink
John, Zdenek, thanks for your most helpful hints.

Below is what I came up with eventually, with MWE attached. The
spacing adjustments are still subject to change. I have no idea
why the spacing adjustments are required in roman! It turns out I
need to fake bold as well, and I will probably need to redefine
`\textbf` eventually, without breaking things I hope!

John, your version worked once I had removed most whitespace,
which leaked through to the output, but I ended up using more
LaTeXy language to help myself keep things straight in my head
when I added the bold(italic) alternatives.

Ross, I believe I am subscribed with my ***@melroch.se address. If
there is a problem with this mail too I'm probably not, otherwise
there may have been a glitch with using an alternate From address
on my phone. I have my email forwarded around a lot these days.
Hard to disentagle!

/bpj

````
\usepackage{ifthen}
\usepackage{newunicodechar}
\newfontface\fakeslantfont{FreeSerif}[FakeSlant=0.3]
\newfontface\fakeboldfont{FreeSerif}[FakeBold=1.05]
\newfontface\fakeboldslantfont{FreeSerif}[FakeBold=1.1,FakeSlant=0.3]
\newcommand\objLang[1]{{\italictrue\textit{#1}}} % (double braces
to keep things local).
\newcommand\myStrong[1]{{\boldtrue\textbf{#1}}}
\newif\ifitalic
\newif\ifbold
\newcommand\fakeBSChar[1]{% #1 = the char
\newunicodechar{#1}{{%
\ifthenelse{\boolean{italic}}{%
\ifthenelse{\boolean{bold}}{%
\fakeboldslantfont\hspace{-0.07em}#1\hspace{0.05em}}{%
\fakeslantfont\hspace{-0.05em}#1\hspace{0.05em}}}{%
\ifthenelse{\boolean{bold}}{%
\fakeboldfont\hspace{-0.05em}#1\hspace{0.02em}}{%
\hspace{-0.03em}#1}}}}
}
````
John Was
2018-12-05 09:20:09 UTC
Permalink
Hello

I work in plain XeTeX, but I hope the following will work (and make sense)
in XeLaTeX too.

You could redefine \textit, but to keep things simple, set up a new command,
say \Textit, and change all occurrences of \textit to \Textit in your
document (or a copy thereof!).

Thus:

\def\Textit{{\italictrue \textit}} (double braces to keep things local).

You will also need a new \if:

\newif\ifitalic

Now, supposing the character you want to influence as you describe is ć
(Unicode 0107).

Make that active:

\catcode"0107=\active
\defć{{\ifitalic {\fakeslantfont \char"0107} \else \char"0107 \fi}}


Obviously, change \fakeslantfont to whatever you have used to define the
faked italic font. Again I have used double {{ }} for safety.

ć will then appear with artificial slanting whenever it occurs within
\Textit.

And so on for all the characters to be treated this way.

(More elegantly, redefine \textit itself but I'm not experienced with the
LaTeX \renewcommand etc. features.)

Hope this helps (and I hope XeTeX picks up on the fact that I'm actually now
at ***@gmail.com!)

Best


John




-----Original Message-----
From: Benct Philip Jonsson
Sent: Tuesday, December 04, 2018 7:57 PM
To: ***@tug.org
Subject: [XeTeX] Fake italics for some characters only

I have a somewhat unusual problem. In a document produced using
XeLaTeX I need to use four Unicode letters with scarce font
support in italicized words and passages but the font which I have
to use supports these characters only in roman. The obvious
solution is to use the FakeSlant feature of fontspec but I don’t
want to enclose these characters in a command argument, in the
hope that a future version of the document can use an italic font
which supports these characters, but neither do I (perhaps
needless to say) want to use fake italics except for these four
characters. In other words I would like to perform some kind of
“keyhole surgery” in the preamble and use these characters
normally in the body of the document, which I guess means having
to make them active and somehow detect when they are inside the
argument of `\textit`. (Note: it is appropriate to use `\textit`
rather than `\emph` here because the purpose of the italicization
is to mark text as being in an object language in a linguistic
text.) Is that at all possible? I guess I could wrap `\textit` in
a macro which locally redefines the active characters, but I’m not
sure how to do that, nor how to access the glyphs corresponding to
the characters once the characters are active. I am a user who
isn’t afraid of using and making the most of various packages or
of writing an occasional custom command to wrap up some repeatedly
needed operation, but I am no expert. I am aware of all the
arguments against fake italics — that is why I want to limit the
damage as much as possible! — but I have no choice here. Waiting
for the/an appropriate font to include italic versions of these
characters is not an option at the moment.

/Benct



--------------------------------------------------
Subscriptions, Archive, and List information, etc.:
http://tug.org/mailman/listinfo/xetex



--------------------------------------------------
Subscriptions, Archive, and List information, etc.:
http://tug.org/mailman/listinfo/x
Zdenek Wagner
2018-12-05 12:10:28 UTC
Permalink
Hi,

this will not work. \textit is a macro which requires a parameter,
thus \textit} will report an unbalaced brace. Returning to my solution
I forgot to write that the active characters must first be defined.
You either activate them, define them and then deactivate them which
is tedious. It is better to define them inside a group but the
definition must be global, it cannot be done with \newcommand. If you
define just one character (i.e. A), \gdef is not needed, it can be
done by:

\begingroup \catcode`\A=13
\expandafter\endgroup\expandafter\def\noexpand A{{\fakeslantfont A}}

If you need several characters, i.e. A and B, you can either repet the
block or do it like that:

\begingroup
\uccode`\x=A
\uccode`\y=B
\catcode`\A=13
\catcode`\B=13
\uppercase{
\gdef A{{\fakeslantfont x}}
\gdef B{{\fakeslantfont y}}
}
\endgroup

Notice that the characters remain inactive, with chategory 11
(letter). They will be activated inside a group defined by \mytextit
from my previous mail. \mytextit must not have a parameter because
once set tha categories cannot be changed (unless you use lua or
possibly eTeX). \dotextit will then take the parameter with active A
anb B and closes the group so that the categories return to 11. There
is no need to use \if.

Zdeněk Wagner
http://ttsm.icpf.cas.cz/team/wagner.shtml
http://icebearsoft.euweb.cz
st 5. 12. 2018 v 12:39 odesílatel John Was <***@ntlworld.com> napsal:
>
> Hello
>
> I work in plain XeTeX, but I hope the following will work (and make sense)
> in XeLaTeX too.
>
> You could redefine \textit, but to keep things simple, set up a new command,
> say \Textit, and change all occurrences of \textit to \Textit in your
> document (or a copy thereof!).
>
> Thus:
>
> \def\Textit{{\italictrue \textit}} (double braces to keep things local).
>
> You will also need a new \if:
>
> \newif\ifitalic
>
> Now, supposing the character you want to influence as you describe is ć
> (Unicode 0107).
>
> Make that active:
>
> \catcode"0107=\active
> \defć{{\ifitalic {\fakeslantfont \char"0107} \else \char"0107 \fi}}
>
>
> Obviously, change \fakeslantfont to whatever you have used to define the
> faked italic font. Again I have used double {{ }} for safety.
>
> ć will then appear with artificial slanting whenever it occurs within
> \Textit.
>
> And so on for all the characters to be treated this way.
>
> (More elegantly, redefine \textit itself but I'm not experienced with the
> LaTeX \renewcommand etc. features.)
>
> Hope this helps (and I hope XeTeX picks up on the fact that I'm actually now
> at ***@gmail.com!)
>
> Best
>
>
> John
>
>
>
>
> -----Original Message-----
> From: Benct Philip Jonsson
> Sent: Tuesday, December 04, 2018 7:57 PM
> To: ***@tug.org
> Subject: [XeTeX] Fake italics for some characters only
>
> I have a somewhat unusual problem. In a document produced using
> XeLaTeX I need to use four Unicode letters with scarce font
> support in italicized words and passages but the font which I have
> to use supports these characters only in roman. The obvious
> solution is to use the FakeSlant feature of fontspec but I don’t
> want to enclose these characters in a command argument, in the
> hope that a future version of the document can use an italic font
> which supports these characters, but neither do I (perhaps
> needless to say) want to use fake italics except for these four
> characters. In other words I would like to perform some kind of
> “keyhole surgery” in the preamble and use these characters
> normally in the body of the document, which I guess means having
> to make them active and somehow detect when they are inside the
> argument of `\textit`. (Note: it is appropriate to use `\textit`
> rather than `\emph` here because the purpose of the italicization
> is to mark text as being in an object language in a linguistic
> text.) Is that at all possible? I guess I could wrap `\textit` in
> a macro which locally redefines the active characters, but I’m not
> sure how to do that, nor how to access the glyphs corresponding to
> the characters once the characters are active. I am a user who
> isn’t afraid of using and making the most of various packages or
> of writing an occasional custom command to wrap up some repeatedly
> needed operation, but I am no expert. I am aware of all the
> arguments against fake italics — that is why I want to limit the
> damage as much as possible! — but I have no choice here. Waiting
> for the/an appropriate font to include italic versions of these
> characters is not an option at the moment.
>
> /Benct
>
>
>
> --------------------------------------------------
> Subscriptions, Archive, and List information, etc.:
> http://tug.org/mailman/listinfo/xetex
>
>
>
> --------------------------------------------------
> Subscriptions, Archive, and List information, etc.:
> http://tug.org/mailman/listinfo/xetex



--------------------------------------------------
Subscriptions, Archive, and List information, etc.:
http://tug.org/ma
John Was
2018-12-05 13:47:13 UTC
Permalink
Hello

I didn't realize that textit took an argument, but my solution will work
(I've used the \ifitalic trick for years for different purposes!), at least
in plain XeTeX language, if one just adds the argument to the definition:

\def\Textit#1{{\italictrue \textit #1}}

Anyway, I hope that helps in the search for an elegant solution which
doesn't clutter up the input file.


John

-----Original Message-----
From: Zdenek Wagner
Sent: Wednesday, December 05, 2018 12:10 PM
To: Unicode-based TeX for Mac OS X and other platforms
Subject: Re: [XeTeX] Fake italics for some characters only

Hi,

this will not work. \textit is a macro which requires a parameter,
thus \textit} will report an unbalaced brace. Returning to my solution
I forgot to write that the active characters must first be defined.
You either activate them, define them and then deactivate them which
is tedious. It is better to define them inside a group but the
definition must be global, it cannot be done with \newcommand. If you
define just one character (i.e. A), \gdef is not needed, it can be
done by:

\begingroup \catcode`\A=13
\expandafter\endgroup\expandafter\def\noexpand A{{\fakeslantfont A}}

If you need several characters, i.e. A and B, you can either repet the
block or do it like that:

\begingroup
\uccode`\x=A
\uccode`\y=B
\catcode`\A=13
\catcode`\B=13
\uppercase{
\gdef A{{\fakeslantfont x}}
\gdef B{{\fakeslantfont y}}
}
\endgroup

Notice that the characters remain inactive, with chategory 11
(letter). They will be activated inside a group defined by \mytextit
from my previous mail. \mytextit must not have a parameter because
once set tha categories cannot be changed (unless you use lua or
possibly eTeX). \dotextit will then take the parameter with active A
anb B and closes the group so that the categories return to 11. There
is no need to use \if.

Zdeněk Wagner
http://ttsm.icpf.cas.cz/team/wagner.shtml
http://icebearsoft.euweb.cz
st 5. 12. 2018 v 12:39 odesílatel John Was <***@ntlworld.com> napsal:
>
> Hello
>
> I work in plain XeTeX, but I hope the following will work (and make sense)
> in XeLaTeX too.
>
> You could redefine \textit, but to keep things simple, set up a new
> command,
> say \Textit, and change all occurrences of \textit to \Textit in your
> document (or a copy thereof!).
>
> Thus:
>
> \def\Textit{{\italictrue \textit}} (double braces to keep things local).
>
> You will also need a new \if:
>
> \newif\ifitalic
>
> Now, supposing the character you want to influence as you describe is ć
> (Unicode 0107).
>
> Make that active:
>
> \catcode"0107=\active
> \defć{{\ifitalic {\fakeslantfont \char"0107} \else \char"0107 \fi}}
>
>
> Obviously, change \fakeslantfont to whatever you have used to define the
> faked italic font. Again I have used double {{ }} for safety.
>
> ć will then appear with artificial slanting whenever it occurs within
> \Textit.
>
> And so on for all the characters to be treated this way.
>
> (More elegantly, redefine \textit itself but I'm not experienced with the
> LaTeX \renewcommand etc. features.)
>
> Hope this helps (and I hope XeTeX picks up on the fact that I'm actually
> now
> at ***@gmail.com!)
>
> Best
>
>
> John
>
>
>
>
> -----Original Message-----
> From: Benct Philip Jonsson
> Sent: Tuesday, December 04, 2018 7:57 PM
> To: ***@tug.org
> Subject: [XeTeX] Fake italics for some characters only
>
> I have a somewhat unusual problem. In a document produced using
> XeLaTeX I need to use four Unicode letters with scarce font
> support in italicized words and passages but the font which I have
> to use supports these characters only in roman. The obvious
> solution is to use the FakeSlant feature of fontspec but I don’t
> want to enclose these characters in a command argument, in the
> hope that a future version of the document can use an italic font
> which supports these characters, but neither do I (perhaps
> needless to say) want to use fake italics except for these four
> characters. In other words I would like to perform some kind of
> “keyhole surgery” in the preamble and use these characters
> normally in the body of the document, which I guess means having
> to make them active and somehow detect when they are inside the
> argument of `\textit`. (Note: it is appropriate to use `\textit`
> rather than `\emph` here because the purpose of the italicization
> is to mark text as being in an object language in a linguistic
> text.) Is that at all possible? I guess I could wrap `\textit` in
> a macro which locally redefines the active characters, but I’m not
> sure how to do that, nor how to access the glyphs corresponding to
> the characters once the characters are active. I am a user who
> isn’t afraid of using and making the most of various packages or
> of writing an occasional custom command to wrap up some repeatedly
> needed operation, but I am no expert. I am aware of all the
> arguments against fake italics — that is why I want to limit the
> damage as much as possible! — but I have no choice here. Waiting
> for the/an appropriate font to include italic versions of these
> characters is not an option at the moment.
>
> /Benct
>
>
>
> --------------------------------------------------
> Subscriptions, Archive, and List information, etc.:
> http://tug.org/mailman/listinfo/xetex
>
>
>
> --------------------------------------------------
> Subscriptions, Archive, and List information, etc.:
> http://tug.org/mailman/listinfo/xetex



--------------------------------------------------
Subscriptions, Archive, and List information, etc.:
http://tug.org/mailman/listinfo/xetex



--------------------------------------------------
Subscriptions, Archive, and List information, etc.:
http://tug
Zdenek Wagner
2018-12-05 14:17:43 UTC
Permalink
Hello,

you need braces around #1, otherwise \textit takes just the first
token (character) and the rest will remain unchanged.

Zdeněk Wagner
http://ttsm.icpf.cas.cz/team/wagner.shtml
http://icebearsoft.euweb.cz

st 5. 12. 2018 v 15:12 odesílatel John Was <***@ntlworld.com> napsal:
>
> Hello
>
> I didn't realize that textit took an argument, but my solution will work
> (I've used the \ifitalic trick for years for different purposes!), at least
> in plain XeTeX language, if one just adds the argument to the definition:
>
> \def\Textit#1{{\italictrue \textit #1}}
>
> Anyway, I hope that helps in the search for an elegant solution which
> doesn't clutter up the input file.
>
>
> John
>
> -----Original Message-----
> From: Zdenek Wagner
> Sent: Wednesday, December 05, 2018 12:10 PM
> To: Unicode-based TeX for Mac OS X and other platforms
> Subject: Re: [XeTeX] Fake italics for some characters only
>
> Hi,
>
> this will not work. \textit is a macro which requires a parameter,
> thus \textit} will report an unbalaced brace. Returning to my solution
> I forgot to write that the active characters must first be defined.
> You either activate them, define them and then deactivate them which
> is tedious. It is better to define them inside a group but the
> definition must be global, it cannot be done with \newcommand. If you
> define just one character (i.e. A), \gdef is not needed, it can be
> done by:
>
> \begingroup \catcode`\A=13
> \expandafter\endgroup\expandafter\def\noexpand A{{\fakeslantfont A}}
>
> If you need several characters, i.e. A and B, you can either repet the
> block or do it like that:
>
> \begingroup
> \uccode`\x=A
> \uccode`\y=B
> \catcode`\A=13
> \catcode`\B=13
> \uppercase{
> \gdef A{{\fakeslantfont x}}
> \gdef B{{\fakeslantfont y}}
> }
> \endgroup
>
> Notice that the characters remain inactive, with chategory 11
> (letter). They will be activated inside a group defined by \mytextit
> from my previous mail. \mytextit must not have a parameter because
> once set tha categories cannot be changed (unless you use lua or
> possibly eTeX). \dotextit will then take the parameter with active A
> anb B and closes the group so that the categories return to 11. There
> is no need to use \if.
>
> Zdeněk Wagner
> http://ttsm.icpf.cas.cz/team/wagner.shtml
> http://icebearsoft.euweb.cz
> st 5. 12. 2018 v 12:39 odesílatel John Was <***@ntlworld.com> napsal:
> >
> > Hello
> >
> > I work in plain XeTeX, but I hope the following will work (and make sense)
> > in XeLaTeX too.
> >
> > You could redefine \textit, but to keep things simple, set up a new
> > command,
> > say \Textit, and change all occurrences of \textit to \Textit in your
> > document (or a copy thereof!).
> >
> > Thus:
> >
> > \def\Textit{{\italictrue \textit}} (double braces to keep things local).
> >
> > You will also need a new \if:
> >
> > \newif\ifitalic
> >
> > Now, supposing the character you want to influence as you describe is ć
> > (Unicode 0107).
> >
> > Make that active:
> >
> > \catcode"0107=\active
> > \defć{{\ifitalic {\fakeslantfont \char"0107} \else \char"0107 \fi}}
> >
> >
> > Obviously, change \fakeslantfont to whatever you have used to define the
> > faked italic font. Again I have used double {{ }} for safety.
> >
> > ć will then appear with artificial slanting whenever it occurs within
> > \Textit.
> >
> > And so on for all the characters to be treated this way.
> >
> > (More elegantly, redefine \textit itself but I'm not experienced with the
> > LaTeX \renewcommand etc. features.)
> >
> > Hope this helps (and I hope XeTeX picks up on the fact that I'm actually
> > now
> > at ***@gmail.com!)
> >
> > Best
> >
> >
> > John
> >
> >
> >
> >
> > -----Original Message-----
> > From: Benct Philip Jonsson
> > Sent: Tuesday, December 04, 2018 7:57 PM
> > To: ***@tug.org
> > Subject: [XeTeX] Fake italics for some characters only
> >
> > I have a somewhat unusual problem. In a document produced using
> > XeLaTeX I need to use four Unicode letters with scarce font
> > support in italicized words and passages but the font which I have
> > to use supports these characters only in roman. The obvious
> > solution is to use the FakeSlant feature of fontspec but I don’t
> > want to enclose these characters in a command argument, in the
> > hope that a future version of the document can use an italic font
> > which supports these characters, but neither do I (perhaps
> > needless to say) want to use fake italics except for these four
> > characters. In other words I would like to perform some kind of
> > “keyhole surgery” in the preamble and use these characters
> > normally in the body of the document, which I guess means having
> > to make them active and somehow detect when they are inside the
> > argument of `\textit`. (Note: it is appropriate to use `\textit`
> > rather than `\emph` here because the purpose of the italicization
> > is to mark text as being in an object language in a linguistic
> > text.) Is that at all possible? I guess I could wrap `\textit` in
> > a macro which locally redefines the active characters, but I’m not
> > sure how to do that, nor how to access the glyphs corresponding to
> > the characters once the characters are active. I am a user who
> > isn’t afraid of using and making the most of various packages or
> > of writing an occasional custom command to wrap up some repeatedly
> > needed operation, but I am no expert. I am aware of all the
> > arguments against fake italics — that is why I want to limit the
> > damage as much as possible! — but I have no choice here. Waiting
> > for the/an appropriate font to include italic versions of these
> > characters is not an option at the moment.
> >
> > /Benct
> >
> >
> >
> > --------------------------------------------------
> > Subscriptions, Archive, and List information, etc.:
> > http://tug.org/mailman/listinfo/xetex
> >
> >
> >
> > --------------------------------------------------
> > Subscriptions, Archive, and List information, etc.:
> > http://tug.org/mailman/listinfo/xetex
>
>
>
> --------------------------------------------------
> Subscriptions, Archive, and List information, etc.:
> http://tug.org/mailman/listinfo/xetex
>
>
>
> --------------------------------------------------
> Subscriptions, Archive, and List information, etc.:
> http://tug.org/mailman/listinfo/xetex



--------------------------------------------------
Subscriptions, Archive, and List information, etc.:
John Was
2018-12-05 14:47:26 UTC
Permalink
Ah, another quirk of LaTeX. In plain one just says e.g. (to superimpose
two characters):

\def\overstrike#1#2{\setbox0=\hbox{#1}\setbox1=\hbox{#2}\copy0
\kern -0.5\wd0 \kern -0.5\wd1 \copy1 \kern -0.5\wd1 \kern 0.5\wd0}

Maybe I'll learn LaTeX in my next life...

Best


John

On Wed, 5 Dec 2018 at 14:18, Zdenek Wagner <***@gmail.com> wrote:

> Hello,
>
> you need braces around #1, otherwise \textit takes just the first
> token (character) and the rest will remain unchanged.
>
> Zdeněk Wagner
> http://ttsm.icpf.cas.cz/team/wagner.shtml
> http://icebearsoft.euweb.cz
>
> st 5. 12. 2018 v 15:12 odesílatel John Was <***@ntlworld.com> napsal:
> >
> > Hello
> >
> > I didn't realize that textit took an argument, but my solution will work
> > (I've used the \ifitalic trick for years for different purposes!), at
> least
> > in plain XeTeX language, if one just adds the argument to the definition:
> >
> > \def\Textit#1{{\italictrue \textit #1}}
> >
> > Anyway, I hope that helps in the search for an elegant solution which
> > doesn't clutter up the input file.
> >
> >
> > John
> >
> > -----Original Message-----
> > From: Zdenek Wagner
> > Sent: Wednesday, December 05, 2018 12:10 PM
> > To: Unicode-based TeX for Mac OS X and other platforms
> > Subject: Re: [XeTeX] Fake italics for some characters only
> >
> > Hi,
> >
> > this will not work. \textit is a macro which requires a parameter,
> > thus \textit} will report an unbalaced brace. Returning to my solution
> > I forgot to write that the active characters must first be defined.
> > You either activate them, define them and then deactivate them which
> > is tedious. It is better to define them inside a group but the
> > definition must be global, it cannot be done with \newcommand. If you
> > define just one character (i.e. A), \gdef is not needed, it can be
> > done by:
> >
> > \begingroup \catcode`\A=13
> > \expandafter\endgroup\expandafter\def\noexpand A{{\fakeslantfont A}}
> >
> > If you need several characters, i.e. A and B, you can either repet the
> > block or do it like that:
> >
> > \begingroup
> > \uccode`\x=A
> > \uccode`\y=B
> > \catcode`\A=13
> > \catcode`\B=13
> > \uppercase{
> > \gdef A{{\fakeslantfont x}}
> > \gdef B{{\fakeslantfont y}}
> > }
> > \endgroup
> >
> > Notice that the characters remain inactive, with chategory 11
> > (letter). They will be activated inside a group defined by \mytextit
> > from my previous mail. \mytextit must not have a parameter because
> > once set tha categories cannot be changed (unless you use lua or
> > possibly eTeX). \dotextit will then take the parameter with active A
> > anb B and closes the group so that the categories return to 11. There
> > is no need to use \if.
> >
> > Zdeněk Wagner
> > http://ttsm.icpf.cas.cz/team/wagner.shtml
> > http://icebearsoft.euweb.cz
> > st 5. 12. 2018 v 12:39 odesílatel John Was <***@ntlworld.com>
> napsal:
> > >
> > > Hello
> > >
> > > I work in plain XeTeX, but I hope the following will work (and make
> sense)
> > > in XeLaTeX too.
> > >
> > > You could redefine \textit, but to keep things simple, set up a new
> > > command,
> > > say \Textit, and change all occurrences of \textit to \Textit in your
> > > document (or a copy thereof!).
> > >
> > > Thus:
> > >
> > > \def\Textit{{\italictrue \textit}} (double braces to keep things
> local).
> > >
> > > You will also need a new \if:
> > >
> > > \newif\ifitalic
> > >
> > > Now, supposing the character you want to influence as you describe is ć
> > > (Unicode 0107).
> > >
> > > Make that active:
> > >
> > > \catcode"0107=\active
> > > \defć{{\ifitalic {\fakeslantfont \char"0107} \else \char"0107 \fi}}
> > >
> > >
> > > Obviously, change \fakeslantfont to whatever you have used to define
> the
> > > faked italic font. Again I have used double {{ }} for safety.
> > >
> > > ć will then appear with artificial slanting whenever it occurs within
> > > \Textit.
> > >
> > > And so on for all the characters to be treated this way.
> > >
> > > (More elegantly, redefine \textit itself but I'm not experienced with
> the
> > > LaTeX \renewcommand etc. features.)
> > >
> > > Hope this helps (and I hope XeTeX picks up on the fact that I'm
> actually
> > > now
> > > at ***@gmail.com!)
> > >
> > > Best
> > >
> > >
> > > John
> > >
> > >
> > >
> > >
> > > -----Original Message-----
> > > From: Benct Philip Jonsson
> > > Sent: Tuesday, December 04, 2018 7:57 PM
> > > To: ***@tug.org
> > > Subject: [XeTeX] Fake italics for some characters only
> > >
> > > I have a somewhat unusual problem. In a document produced using
> > > XeLaTeX I need to use four Unicode letters with scarce font
> > > support in italicized words and passages but the font which I have
> > > to use supports these characters only in roman. The obvious
> > > solution is to use the FakeSlant feature of fontspec but I don’t
> > > want to enclose these characters in a command argument, in the
> > > hope that a future version of the document can use an italic font
> > > which supports these characters, but neither do I (perhaps
> > > needless to say) want to use fake italics except for these four
> > > characters. In other words I would like to perform some kind of
> > > “keyhole surgery” in the preamble and use these characters
> > > normally in the body of the document, which I guess means having
> > > to make them active and somehow detect when they are inside the
> > > argument of `\textit`. (Note: it is appropriate to use `\textit`
> > > rather than `\emph` here because the purpose of the italicization
> > > is to mark text as being in an object language in a linguistic
> > > text.) Is that at all possible? I guess I could wrap `\textit` in
> > > a macro which locally redefines the active characters, but I’m not
> > > sure how to do that, nor how to access the glyphs corresponding to
> > > the characters once the characters are active. I am a user who
> > > isn’t afraid of using and making the most of various packages or
> > > of writing an occasional custom command to wrap up some repeatedly
> > > needed operation, but I am no expert. I am aware of all the
> > > arguments against fake italics — that is why I want to limit the
> > > damage as much as possible! — but I have no choice here. Waiting
> > > for the/an appropriate font to include italic versions of these
> > > characters is not an option at the moment.
> > >
> > > /Benct
> > >
> > >
> > >
> > > --------------------------------------------------
> > > Subscriptions, Archive, and List information, etc.:
> > > http://tug.org/mailman/listinfo/xetex
> > >
> > >
> > >
> > > --------------------------------------------------
> > > Subscriptions, Archive, and List information, etc.:
> > > http://tug.org/mailman/listinfo/xetex
> >
> >
> >
> > --------------------------------------------------
> > Subscriptions, Archive, and List information, etc.:
> > http://tug.org/mailman/listinfo/xetex
> >
> >
> >
> > --------------------------------------------------
> > Subscriptions, Archive, and List information, etc.:
> > http://tug.org/mailman/listinfo/xetex
>
>
>
> --------------------------------------------------
> Subscriptions, Archive, and List information, etc.:
> http://tug.org/mailman/listinfo/xetex
>
Zdenek Wagner
2018-12-05 15:17:38 UTC
Permalink
I think I can do the same by
\def\overstrike#1#2{\setbox0=\hbox{#1}\rlap{\copy0}\hbox to \wd0{\hss #2\hss}}

For better versatility I would also add \ifhmode \leavevmode \fi to
the beginning of the macro.

Zdeněk Wagner
http://ttsm.icpf.cas.cz/team/wagner.shtml
http://icebearsoft.euweb.cz

st 5. 12. 2018 v 16:07 odesílatel John Was <***@gmail.com> napsal:
>
> Ah, another quirk of LaTeX. In plain one just says e.g. (to superimpose two characters):
>
> \def\overstrike#1#2{\setbox0=\hbox{#1}\setbox1=\hbox{#2}\copy0
> \kern -0.5\wd0 \kern -0.5\wd1 \copy1 \kern -0.5\wd1 \kern 0.5\wd0}
>
> Maybe I'll learn LaTeX in my next life...
>
> Best
>
>
> John
>
> On Wed, 5 Dec 2018 at 14:18, Zdenek Wagner <***@gmail.com> wrote:
>>
>> Hello,
>>
>> you need braces around #1, otherwise \textit takes just the first
>> token (character) and the rest will remain unchanged.
>>
>> Zdeněk Wagner
>> http://ttsm.icpf.cas.cz/team/wagner.shtml
>> http://icebearsoft.euweb.cz
>>
>> st 5. 12. 2018 v 15:12 odesílatel John Was <***@ntlworld.com> napsal:
>> >
>> > Hello
>> >
>> > I didn't realize that textit took an argument, but my solution will work
>> > (I've used the \ifitalic trick for years for different purposes!), at least
>> > in plain XeTeX language, if one just adds the argument to the definition:
>> >
>> > \def\Textit#1{{\italictrue \textit #1}}
>> >
>> > Anyway, I hope that helps in the search for an elegant solution which
>> > doesn't clutter up the input file.
>> >
>> >
>> > John
>> >
>> > -----Original Message-----
>> > From: Zdenek Wagner
>> > Sent: Wednesday, December 05, 2018 12:10 PM
>> > To: Unicode-based TeX for Mac OS X and other platforms
>> > Subject: Re: [XeTeX] Fake italics for some characters only
>> >
>> > Hi,
>> >
>> > this will not work. \textit is a macro which requires a parameter,
>> > thus \textit} will report an unbalaced brace. Returning to my solution
>> > I forgot to write that the active characters must first be defined.
>> > You either activate them, define them and then deactivate them which
>> > is tedious. It is better to define them inside a group but the
>> > definition must be global, it cannot be done with \newcommand. If you
>> > define just one character (i.e. A), \gdef is not needed, it can be
>> > done by:
>> >
>> > \begingroup \catcode`\A=13
>> > \expandafter\endgroup\expandafter\def\noexpand A{{\fakeslantfont A}}
>> >
>> > If you need several characters, i.e. A and B, you can either repet the
>> > block or do it like that:
>> >
>> > \begingroup
>> > \uccode`\x=A
>> > \uccode`\y=B
>> > \catcode`\A=13
>> > \catcode`\B=13
>> > \uppercase{
>> > \gdef A{{\fakeslantfont x}}
>> > \gdef B{{\fakeslantfont y}}
>> > }
>> > \endgroup
>> >
>> > Notice that the characters remain inactive, with chategory 11
>> > (letter). They will be activated inside a group defined by \mytextit
>> > from my previous mail. \mytextit must not have a parameter because
>> > once set tha categories cannot be changed (unless you use lua or
>> > possibly eTeX). \dotextit will then take the parameter with active A
>> > anb B and closes the group so that the categories return to 11. There
>> > is no need to use \if.
>> >
>> > Zdeněk Wagner
>> > http://ttsm.icpf.cas.cz/team/wagner.shtml
>> > http://icebearsoft.euweb.cz
>> > st 5. 12. 2018 v 12:39 odesílatel John Was <***@ntlworld.com> napsal:
>> > >
>> > > Hello
>> > >
>> > > I work in plain XeTeX, but I hope the following will work (and make sense)
>> > > in XeLaTeX too.
>> > >
>> > > You could redefine \textit, but to keep things simple, set up a new
>> > > command,
>> > > say \Textit, and change all occurrences of \textit to \Textit in your
>> > > document (or a copy thereof!).
>> > >
>> > > Thus:
>> > >
>> > > \def\Textit{{\italictrue \textit}} (double braces to keep things local).
>> > >
>> > > You will also need a new \if:
>> > >
>> > > \newif\ifitalic
>> > >
>> > > Now, supposing the character you want to influence as you describe is ć
>> > > (Unicode 0107).
>> > >
>> > > Make that active:
>> > >
>> > > \catcode"0107=\active
>> > > \defć{{\ifitalic {\fakeslantfont \char"0107} \else \char"0107 \fi}}
>> > >
>> > >
>> > > Obviously, change \fakeslantfont to whatever you have used to define the
>> > > faked italic font. Again I have used double {{ }} for safety.
>> > >
>> > > ć will then appear with artificial slanting whenever it occurs within
>> > > \Textit.
>> > >
>> > > And so on for all the characters to be treated this way.
>> > >
>> > > (More elegantly, redefine \textit itself but I'm not experienced with the
>> > > LaTeX \renewcommand etc. features.)
>> > >
>> > > Hope this helps (and I hope XeTeX picks up on the fact that I'm actually
>> > > now
>> > > at ***@gmail.com!)
>> > >
>> > > Best
>> > >
>> > >
>> > > John
>> > >
>> > >
>> > >
>> > >
>> > > -----Original Message-----
>> > > From: Benct Philip Jonsson
>> > > Sent: Tuesday, December 04, 2018 7:57 PM
>> > > To: ***@tug.org
>> > > Subject: [XeTeX] Fake italics for some characters only
>> > >
>> > > I have a somewhat unusual problem. In a document produced using
>> > > XeLaTeX I need to use four Unicode letters with scarce font
>> > > support in italicized words and passages but the font which I have
>> > > to use supports these characters only in roman. The obvious
>> > > solution is to use the FakeSlant feature of fontspec but I don’t
>> > > want to enclose these characters in a command argument, in the
>> > > hope that a future version of the document can use an italic font
>> > > which supports these characters, but neither do I (perhaps
>> > > needless to say) want to use fake italics except for these four
>> > > characters. In other words I would like to perform some kind of
>> > > “keyhole surgery” in the preamble and use these characters
>> > > normally in the body of the document, which I guess means having
>> > > to make them active and somehow detect when they are inside the
>> > > argument of `\textit`. (Note: it is appropriate to use `\textit`
>> > > rather than `\emph` here because the purpose of the italicization
>> > > is to mark text as being in an object language in a linguistic
>> > > text.) Is that at all possible? I guess I could wrap `\textit` in
>> > > a macro which locally redefines the active characters, but I’m not
>> > > sure how to do that, nor how to access the glyphs corresponding to
>> > > the characters once the characters are active. I am a user who
>> > > isn’t afraid of using and making the most of various packages or
>> > > of writing an occasional custom command to wrap up some repeatedly
>> > > needed operation, but I am no expert. I am aware of all the
>> > > arguments against fake italics — that is why I want to limit the
>> > > damage as much as possible! — but I have no choice here. Waiting
>> > > for the/an appropriate font to include italic versions of these
>> > > characters is not an option at the moment.
>> > >
>> > > /Benct
>> > >
>> > >
>> > >
>> > > --------------------------------------------------
>> > > Subscriptions, Archive, and List information, etc.:
>> > > http://tug.org/mailman/listinfo/xetex
>> > >
>> > >
>> > >
>> > > --------------------------------------------------
>> > > Subscriptions, Archive, and List information, etc.:
>> > > http://tug.org/mailman/listinfo/xetex
>> >
>> >
>> >
>> > --------------------------------------------------
>> > Subscriptions, Archive, and List information, etc.:
>> > http://tug.org/mailman/listinfo/xetex
>> >
>> >
>> >
>> > --------------------------------------------------
>> > Subscriptions, Archive, and List information, etc.:
>> > http://tug.org/mailman/listinfo/xetex
>>
>>
>>
>> --------------------------------------------------
>> Subscriptions, Archive, and List information, etc.:
>> http://tug.org/mailman/listinfo/xetex
>
>
>
> --------------------------------------------------
> Subscriptions, Archive, and List information, etc.:
> http://tug.org/mailman/listinfo/xetex



--------------------------------------------------
Subscriptions, Archive, and List information,
Arthur Reutenauer
2018-12-05 15:16:10 UTC
Permalink
On Wed, Dec 05, 2018 at 02:47:26PM +0000, John Was wrote:
> Ah, another quirk of LaTeX.

Of TeX. As you can see in your own example:

> \def\overstrike#1#2{\setbox0=\hbox{#1}\setbox1=\hbox{#2}\copy0
> \kern -0.5\wd0 \kern -0.5\wd1 \copy1 \kern -0.5\wd1 \kern 0.5\wd0}

the arguments are surrounded by curly braces in the macro definition.
With the definition you wrote:

>>> \def\Textit#1{{\italictrue \textit #1}}

\textit would use only the first token of #1 at the end of the
definition. This has nothing to do with LaTeX macros or syntax.

Best,

Arthur


--------------------------------------------------
Subscriptions, Archive, and List information, etc.:
http://tug.org/mailman/listinfo/xetex
John Was
2018-12-05 16:06:12 UTC
Permalink
Hello

Not a good example obviously - the macros are surrounded by braces in the
definition only because they are in an \hbox there. But the braces are
certainly needed in *usage*: \overstrike{b}{p} (to give a rough impression
of a thorn). But if you wanted a simple macro, say one that reversed two
arguments, you could have e.g.

\def\swap#1#2{#2#1}

with no extra braces aside from those needed to open and close the
definition. You would still need them in *usage*, of course.

But we're rather far from the original question by now! I hope the fake
italics are now working, however he is achieving them.

Best


John



On Wed, 5 Dec 2018 at 15:58, Arthur Reutenauer <
***@normalesup.org> wrote:

> On Wed, Dec 05, 2018 at 02:47:26PM +0000, John Was wrote:
> > Ah, another quirk of LaTeX.
>
> Of TeX. As you can see in your own example:
>
> > \def\overstrike#1#2{\setbox0=\hbox{#1}\setbox1=\hbox{#2}\copy0
> > \kern -0.5\wd0 \kern -0.5\wd1 \copy1 \kern -0.5\wd1 \kern 0.5\wd0}
>
> the arguments are surrounded by curly braces in the macro definition.
> With the definition you wrote:
>
> >>> \def\Textit#1{{\italictrue \textit #1}}
>
> \textit would use only the first token of #1 at the end of the
> definition. This has nothing to do with LaTeX macros or syntax.
>
> Best,
>
> Arthur
>
>
> --------------------------------------------------
> Subscriptions, Archive, and List information, etc.:
> http://tug.org/mailman/listinfo/xetex
>
Loading...