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 <johno...@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 <zdenek.wag...@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 <john....@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 <john....@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 johno...@gmail.com!) >> > > >> > > Best >> > > >> > > >> > > John >> > > >> > > >> > > >> > > >> > > -----Original Message----- >> > > From: Benct Philip Jonsson >> > > Sent: Tuesday, December 04, 2018 7:57 PM >> > > To: xetex@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, etc.: http://tug.org/mailman/listinfo/xetex