XeTeXWhat is the command "\U" used for?

Information and discussion about XeTeX, an alternative for pdfTeX based on e-Tex
Post Reply
tafi
Posts: 42
Joined: Sat May 07, 2011 12:01 am

What is the command "\U" used for?

Post by tafi »

I have tried to define "\U" (specifically the uppercase U) for a shortcut with newcommand. Currently I'm using xelatex.

The definition works fine in PDFlatex but does not work in either latex or xelatex. I've looked high and low to try to find what it is used for for but have never been able to find it.

Does anyone out there know what \U is for?

I'd like to be able to redefine it but I don't know if it is safe to do so.

Thanks in advance
Last edited by tafi on Mon Jul 18, 2011 6:14 am, edited 1 time in total.

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org
LaTeX Beginner's Guide LaTeX Cookbook LaTeX TikZ graphics TikZによるLaTeXグラフィックス
User avatar
Stefan Kottwitz
Site Admin
Posts: 10290
Joined: Mon Mar 10, 2008 9:44 pm

What is the command "\U" used for?

Post by Stefan Kottwitz »

Hi tafi,

\show\U shows that (if for example fontspec or xltxtra is used) \U is

Code: Select all

\OT1-cmd \U\OT1\U
and OT1-cmd is described here in section 3 Encoding.


Stefan
LaTeX.org admin
tafi
Posts: 42
Joined: Sat May 07, 2011 12:01 am

Re: What is the command "\U" used for?

Post by tafi »

Thanks Stefan,

So I guess that means that using T1 in PDFlatex wouldn't give me a problem. Xelatex, on the other hand, should be able to see all accent macros (for unicode) and I suppose that is why it complains about \U

What I'm trying to do is to define isotope shortcuts. In this example uranium-238 would have to be entered using the mhchem package as \ce{^{238}U}. I've tried to condense this down with:

\newcommand{\U}[1]{\ce{^{#1}U}}

so that I only need to define a new command for each element. using \U{238}
makes it far more readable in text and is also easier to type. Now I need to typeset LOTS of isotopes and there are a few of these element symbols which appear to conflict with existing commands (\Re - for rhenium is another example and so is \B for boron).
I could use \Uran{238} or similar but then it wouldn't be the shortest of shorthand anymore.

I could also define a command like \U-238 instead:

\newcommand{\U-238}{\ce{^{238}U}\xspace}

which means would then need to enter a new command for EVERY isotope rather than for just the element (and a huge preamble). But it will at least be faster to type, be readable and unlikely to cause conflict.

Perhaps someone has a better idea for this sort of usage which may not conflict.

EDIT:
I Have now found other errors with this second idea (delimeter like "-" cannot be used in the argument for \newcommand.

This is now a separate question which I will put in a new thread.
Post Reply