Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

Is there a way to directly input angle brackets into text without resorting to math-mode symbols?

I'd like to correctly indicate orthography in a linguistics paper, and have been resorting to single guillemots ‹ › as they are simple to type and display correctly. But I'd prefer to use angle brackets like ⟨ ⟩ . If I input these directly (U+27E8 and U+27E9), they don't display correctly—I prefer the Linux Libertine font family—but $\langle$ $\rangle$ display just fine. As the rest of my document(s) use UTF-8 and fontspec, I'd prefer not to clutter up the body text with math commands.

Is there a way around this?

share|improve this question
    
If you type them very often, you can use one of the methods in tex.stackexchange.com/questions/1979/… to map ⟨⟩ directly to some keys. For example Neo has them on Mod5 + 8,9. –  Caramdir Mar 18 '12 at 16:14
    
I tried that, and then I get crossed out boxes in the output, though not in Vim when I type them. –  zoqaeski Mar 21 '12 at 1:20
    
Sorry, I misunderstood the problem, I should have read more carefully. –  Caramdir Mar 21 '12 at 17:10

2 Answers 2

up vote 4 down vote accepted

fontspec doesn't have an interface for substituting some characters with characters from a different font, but thankfully egreg provided a package to do just that:

\documentclass{article}
\usepackage{fontspec}
\usepackage{newunicodechar}
\setmainfont{Linux Libertine O}

\newfontfamily\anglefont{Free Serif}    % Change to whatever font you prefer that has ⟨⟩.
\newunicodechar{⟨}{{\anglefont ⟩}}
\newunicodechar{⟩}{{\anglefont ⟨}}

\begin{document}
This is Linux Libertine with ⟨ and ⟩ from {\anglefont Free Serif}.
\end{document}

result

share|improve this answer
    
You can even say \newunicodechar{⟨}{{\anglefont ⟨}} No need to hunt through the Unicode character table. ;-) –  egreg Mar 21 '12 at 17:30
    
@egreg: In the documentation you do \newunicodechar{€}{{\eurofont\texteuro}}, so I thought that using the symbol directly is not possible. –  Caramdir Mar 21 '12 at 17:53
    
I have to update it; that example is really for utf8 and (pdf)LaTeX rather than XeLaTeX or LuaLaTeX. –  egreg Mar 21 '12 at 20:26
    
Thanks! This did the trick, and XeLaTeX isn't spitting any errors, so I'll assume it works. –  zoqaeski Apr 3 '12 at 4:40

You could employ the commands \textlangle and \textrangle provided by the textcomp package. If that's too many letters to type each time, you could define shortcuts for them, say \la and \ra. The following MWE illustrates this idea, also

% !TEX TS-program = xelatex
\documentclass{article}
\usepackage{fontspec}
% \setmainfont{Linux Libertine O} % select your main text font here
\usepackage{textcomp,    % for \textlangle and \textrangle macros
            xspace}
\newcommand\la{\textlangle\xspace}  % set up short-form macros
\newcommand\ra{\textrangle\xspace}
\begin{document}
\noindent
\textlangle\ and \textrangle; \newline 
\la and \ra.   % abbreviated macros; note: no need to insert explicit whitespace after "\la"
\end{document}

enter image description here

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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