5

This is question is only limited to using fontspec + luatex with the default TU encoding. The files are always in UTF-8. Is there any practical difference between, say

\DeclareTextSymbol{\textparagraph}       \UnicodeEncodingName{"00B6}

(above from tuenc.def) and simply

\def\textparagraph{\char"00B6}

(or perhaps a robust version).

6

The first form actually defines \textparagraph to expand to

\TU-cmd \textparagraph \TU\textparagraph

(three tokens); the first is a macro that checks the current encoding and, in case it's not TU, does the necessary changes in order to use the version of \textparagraph for the current encoding (or the default). The second token is used for warning or error messages, the third one is the most important one, as it expands to

\char"B6

The shorter version wouldn't be the same, because if you happen to use \textparagraph in a context where a different font encoding is used (for whatever reason), you might end up with something unexpected.

  • Thanks. So, if say I only use TU, then the output would be exactly identical? – Yan Zhou Feb 10 '17 at 17:01
  • @YanZhou Yes, but there's no point in “simplifying” the definition. Anyway, it should be \protected\def\textparagraph{\symbol{"B6}} – egreg Feb 10 '17 at 17:03
  • Sure, in general I would make it protected. My situation is that sometime I need to use a private code point, say a variant of floral heart, which does not even exist in other fonts in general, and certainly not in the same point. I was wondering if there's any disadvantage to simply use \char in the mid of text in the rare occasions that they are needed. – Yan Zhou Feb 10 '17 at 17:17
  • @YanZhou It's better to use \symbol anyway. For instance, \char"B6 x would have no space. – egreg Feb 10 '17 at 17:33

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.