7

I'm very new to LaTeX but have found it to be enjoyable to work with. Lately I've been focusing on how to get output that will copy/paste well from PDF with special characters. Currently, XeLaTeX with the Fontspec package seems to do the job rather nicely. However, I notice that subscripts and superscripts within the context of math, when copy/pasted, result in the unicode character for the full-sized glyph rather than the unicode character for the sub or super script. Why is that?

  • 6
    Aside from any other considerations (such as requiring a font that supports them), there are only a very limited number of Unicode superscripts and subscripts. You'd end up with a mixture of sub/super-script glyphs for the supported ones and full-sized glyphs for the unsupported characters. – Nicola Talbot Apr 30 '18 at 19:34
  • You are too modern for TeX that's probably why :) – percusse Apr 30 '18 at 23:23
  • 3
    PDF is not designed for copying from. That you get anything close at all is always a miracle. – ShreevatsaR Apr 30 '18 at 23:42
7

Unicode superscripts are handy for small in-text superscripts such as x² but they mostly would get in the way in math typesetting where you need to position superscripts at different heights depending on the size of the base, or the presence of a subscript, and you want the formatting of x^2 to be consistent with that of x^{(x+\sqrt{y})} which is difficult to achieve if "simple" cases are set by the font machinery using Unicode superscript characters from the base fonts and "complicated" cases are set by the math layout engine using a script sized font.

  • I think the question is not exactly about typesetting using Unicode superscript characters, but about why, when one copies from the PDF, the copied text doesn't contain Unicode superscripts. Nevertheless the reasons listed in this answer still apply. – ShreevatsaR Apr 30 '18 at 23:54
  • can't you improve that: there is still one comma (even two! I am disappointed) in your paragraph, which allowed me to take my breath midway :) – user4686 May 1 '18 at 9:44
  • Aha! This is a helpful reminder to me that LaTeX is first and foremost intended for layout and one should NOT cast cares of data definition upon it. Many thanks to all. – Robert Browder May 3 '18 at 13:00
  • @RobertBrowder actually I would draw the opposite conclusion from this answer. If you write x^2 or \operatorname{power}(x,2) the 2 is the same thing, the fact that one notation raises it in a smaller font is purely a visual artefact. That said it is more natural to use the same (standard) 2 in the encoding of both if you want to use the same Unicode character for the same semantic data. – David Carlisle May 3 '18 at 13:12
  • @jfbu IchkönnteesaufDeutschschreibenundkeineKommasoderLeerzeichenhaben. – David Carlisle May 3 '18 at 13: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.