3

It will be like: How to change color of edge of characters?

The codes seem not to work under xelatex envirnment.

Does anyone know how to do this with xelatex?

Thanks

sibscc
  • 105
  • What did you try? Are you saying you tried all 6 or so of the linked solutions? Just saying they don't work doesn't tell us much... – cfr Jan 30 '15 at 03:08
  • In fact, the one which seems most promising given its description, works fine for me... – cfr Jan 30 '15 at 03:23

1 Answers1

7

Several of the solutions you linked to are clearly unsuitable for use with XeLaTeX. However, morbusg's solution works fine for me:

\documentclass{article}
\usepackage{amsmath}
\begin{document}
% ref https://tex.stackexchange.com/a/108348/ by morbusg
\special{pdf:bcolor [.8 0 .8] [0]} % two arrays: first defines fill, second the stroke.
% If array has one entry, it's meaning grayscale, if three: RGB, if four: CMYK.
\special{pdf:literal direct .4 w 2 Tr} % .4 here is the stroke width
Here is some text.
\end{document}

contoured text

So you need to say more about what doesn't work or your configuration if you don't get the same results.

cfr
  • 198,882
  • +1: Do you know a good resource where I can learn more about those PDF literals? – Henri Menke Jan 30 '15 at 06:49
  • @HenriMenke Better ask morbusg, I think. I just followed the answer I linked to and checked it worked with XeLaTeX. – cfr Jan 30 '15 at 12:27
  • Thank you cfr. It works well with xelatex. I have questions about "2 Tr" in \special{pdf:literal direct .4 w 2 Tr} , I switch 2 to 1 only the strok left, others only the inner words. What does "tr" mean thanks – sibscc Feb 06 '15 at 02:53
  • @sibscc I refer you to my comment above in response to Henri Menke's earlier comment. – cfr Feb 06 '15 at 03:25
  • Thanks for this amazing solution. It's, as far as I know, the only way to get real outlines with xetex and fontspec. How do you reset the state after though? It affects everything until end of document. – Artefact2 Feb 15 '17 at 12:10
  • @Artefact2 Have you tried putting it in a group? – cfr Feb 16 '17 at 00:27
  • @cfr No, I don't know how to do it. I managed something by re-invoking the same commands with the previous color and 0 Tr (which is fill only), but I'm not sure this is the optimal solution. – Artefact2 Feb 16 '17 at 01:26
  • @Artefact2 \special{pdf:bcolor [0] [0]} \special{pdf:literal direct 0 w 0 Tr} seems to work. But I don't know if it is right. Your best bet is to comment on the linked answer and ask a new question if that doesn't get a response. – cfr Feb 16 '17 at 02:00
  • 1
    @Artefact2 \special{pdf:bcolor 0} is probably better. See the slides linked in the comment on the original answer at http://project.ktug.org/dvipdfmx/doc/tug2005.pdf. Or it may not be. I know less about this than you do. – cfr Feb 16 '17 at 02:12
  • @Artefact2 http://tex.stackexchange.com/questions/354410/how-should-the-effects-of-manipulating-specials-be-switched-off - I hope you will not mind. – cfr Feb 17 '17 at 23:24