Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Angle brackets in text mode

6,145 views
Skip to first unread message

Thomas Arildsen

unread,
Nov 2, 2010, 5:25:36 AM11/2/10
to
I am trying to figure out the correct way to enter angle brackets in
LaTeX text mode. Entering < and > directly translates into completely
different characters, \langle and \rangle are for math mode and so, I
have resorted to using \verb to produce them in text mode. Is this the
best way? It seems unlikely that I should have to use \verb to get them.

Thomas Arildsen

Enrico Gregorio

unread,
Nov 2, 2010, 6:05:06 AM11/2/10
to
Thomas Arildsen <tha.es...@spamgourmet.com> wrote:

\textlangle and \textrangle from textcomp are exactly for this;
but $\langle$text$\rangle$ works as well.

Ciao
Enrico

August Karlstrom

unread,
Nov 2, 2010, 6:48:06 AM11/2/10
to

In what (semantical) context do you want to use angle brackets?


/August

Robin Fairbairns

unread,
Nov 2, 2010, 6:59:26 AM11/2/10
to
Enrico Gregorio <Facile.d...@in.rete.it> writes:

> Thomas Arildsen <tha.es...@spamgourmet.com> wrote:
>
>> I am trying to figure out the correct way to enter angle brackets in
>> LaTeX text mode. Entering < and > directly translates into completely
>> different characters, \langle and \rangle are for math mode and so, I
>> have resorted to using \verb to produce them in text mode. Is this the
>> best way? It seems unlikely that I should have to use \verb to get them.
>

> \textlangle and \textrangle from textcomp are exactly for this;
> but $\langle$text$\rangle$ works as well.

note that < and > are oddly represented only if you're using the
(default) ot1 encoding.

it _may_ be that your installation is configured so that simply adding

\usepackage[T1]{fontenc}

will sort the problem, but this is a non-trivial change if you're using
the default (computer modern) fonts.

i tend to use

\usepackage[T1]{fontenc}
\usepackage{lmodern}

but, again, that is only ok if your installation has the latin modern
fonts. most recent installations do, but...
--
Robin Fairbairns, Cambridge

August Karlstrom

unread,
Nov 2, 2010, 7:02:53 AM11/2/10
to
On 2010-11-02 11:05, Enrico Gregorio wrote:
> \textlangle and \textrangle from textcomp are exactly for this;
> but $\langle$text$\rangle$ works as well.

I think the general recommendation is to include complete expressions in
math mode. This is to get the correct spacing and sizes. In this
particular case it may not affect the output though but I would prefer
$\langle\mbox{text}\rangle$ over $\langle$text$\rangle$.


/August

Enrico Gregorio

unread,
Nov 2, 2010, 8:20:51 AM11/2/10
to
Robin Fairbairns <rf...@sxp10.cl.cam.ac.uk> wrote:

With \usepackage[T1]{fontenc} you get < and > with the corresponding
input, but I believe that these symbols should not be used in place
of angle brackets.

Ciao
Enrico

Thomas Arildsen

unread,
Nov 3, 2010, 5:41:39 AM11/3/10
to

Thanks to all for the suggestions. That made it a bit clearer.
Best regards,

Thomas Arildsen

Thomas Arildsen

unread,
Nov 3, 2010, 5:43:16 AM11/3/10
to

I am using it to write things like (in some documentation):

Type 'help <function>' too see the help information.

Best regards,
Thomas Arildsen

GL

unread,
Nov 3, 2010, 8:40:48 AM11/3/10
to

The very standard package doc.sty used to make package documentations
defines \meta with
\ensuremath\langle ... \ensuremath\rangle

Precisely:

\DeclareRobustCommand\meta[1]{%
\ensuremath\langle
\ifmmode \expandafter \nfss@text \fi
{%
\meta@font@select
\edef\meta@hyphen@restore
{\hyphenchar\the\font\the\hyphenchar\font}%
\hyphenchar\font\m@ne
\language\l@nohyphenation
#1\/%
\meta@hyphen@restore
}\ensuremath\rangle
}


Yours sincerely.


>
> Best regards,
> Thomas Arildsen

Thomas Arildsen

unread,
Nov 5, 2010, 3:57:43 AM11/5/10
to
On Wed, 03 Nov 2010 13:40:48 +0100, GL wrote:

> Le 03/11/2010 10:43, Thomas Arildsen a écrit :

[snip]


>> I am using it to write things like (in some documentation):
>>
>> Type 'help<function>' too see the help information.
>
> The very standard package doc.sty used to make package documentations
> defines \meta with
> \ensuremath\langle ... \ensuremath\rangle
>
> Precisely:
>
> \DeclareRobustCommand\meta[1]{%
> \ensuremath\langle
> \ifmmode \expandafter \nfss@text \fi
> {%
> \meta@font@select
> \edef\meta@hyphen@restore
> {\hyphenchar\the\font\the\hyphenchar\font}%
> \hyphenchar\font\m@ne
> \language\l@nohyphenation
> #1\/%
> \meta@hyphen@restore
> }\ensuremath\rangle
> }
>
>
> Yours sincerely.

Thanks, I will take a look at that too.
Best regards,

Thomas Arildsen

Dan Luecking

unread,
Nov 5, 2010, 12:52:44 PM11/5/10
to
On Wed, 03 Nov 2010 13:40:48 +0100, GL <goua...@gmail.com> wrote:

>Le 03/11/2010 10:43, Thomas Arildsen a écrit :
>> On Tue, 02 Nov 2010 11:48:06 +0100, August Karlstrom wrote:
>>

[...]

>> I am using it to write things like (in some documentation):
>>
>> Type 'help<function>' too see the help information.
>
>The very standard package doc.sty used to make package documentations
>defines \meta with
> \ensuremath\langle ... \ensuremath\rangle
>
>Precisely:
>
>\DeclareRobustCommand\meta[1]{%
> \ensuremath\langle
> \ifmmode \expandafter \nfss@text \fi
> {%
> \meta@font@select
> \edef\meta@hyphen@restore
> {\hyphenchar\the\font\the\hyphenchar\font}%
> \hyphenchar\font\m@ne
> \language\l@nohyphenation
> #1\/%
> \meta@hyphen@restore
> }\ensuremath\rangle
>}

This seems strange to me. Does setting \hyphenchar\font
to -1 do anything important except turn off hyphenation?
Does setting \language to \l@nohyphenation do anything
important except turn off hyphenation? Are both needed?

I've always used
\ensuremath{\langle\mbox{\itshape#1\/}\rangle}
sometimes with different font selection command(s).
Of course \mbox prevents even manual hyphenation, but
this is something I've never needed.


Dan
To reply by email, change LookInSig to luecking

GL

unread,
Nov 5, 2010, 1:01:55 PM11/5/10
to

\hypenchar\font=-1 does not turn hyphenation off, but set
the hyphen character to an empty character.

Now why not \mbox I don't known. doc.sty wants to stick
to TeX rather than LaTeX, although the command is defined
with \DeclareRobustCommand ...

Donald Arseneau

unread,
Nov 5, 2010, 2:44:56 PM11/5/10
to
GL <goua...@gmail.com> writes:

> > This seems strange to me. Does setting \hyphenchar\font
> > to -1 do anything important except turn off hyphenation?

What do you mean by important? Its detailed behaviour is
different from other methods.

> > Does setting \language to \l@nohyphenation do anything
> > important except turn off hyphenation? Are both needed?

Setting hyphenchar turns off hyphenation *by font*.
Setting language controls hyphenation by language region.
Setting \hyphenpenalty controls hyphenation by paragraph
(relevant value at end of paragraph).

> \hypenchar\font=-1 does not turn hyphenation off, but set
> the hyphen character to an empty character.

You are wrong. However, setting it to a valid number but
an empty character slot does do hyphenation without any
hyphen character. (The TeXbook used to say that missing
characters would inhibit hyphenation.)

--
Donald Arseneau as...@triumf.ca

Dan Luecking

unread,
Nov 5, 2010, 2:56:18 PM11/5/10
to

From the TeXbook, page 454:
"If a suitable starting letter is found, let it be in
font~$f$. Hyphenation is abandoned unless the
^|\hyphenchar| of~$f$ is a number between 0 and~255,
inclusive."

Dan Luecking

unread,
Nov 8, 2010, 1:25:56 PM11/8/10
to
On 05 Nov 2010 11:44:56 -0700, Donald Arseneau <as...@triumf.ca> wrote:

>GL <goua...@gmail.com> writes:
>
>> > This seems strange to me. Does setting \hyphenchar\font
>> > to -1 do anything important except turn off hyphenation?
>
>What do you mean by important? Its detailed behaviour is
>different from other methods.

OK: does it have a purpose inside the definition of \meta
apart from inhibiting hyphenation? Note that, unless the user
changes fonts inside the argument of \meta, the change to
\hyphenchar completely inhihits hyphenation.

>
>> > Does setting \language to \l@nohyphenation do anything
>> > important except turn off hyphenation? Are both needed?
>
>Setting hyphenchar turns off hyphenation *by font*.
>Setting language controls hyphenation by language region.
>Setting \hyphenpenalty controls hyphenation by paragraph
>(relevant value at end of paragraph).

Again, unless the user changes language inside the argument
of \meta, this change inhibits hyphenation.

The authors of \meta seems to have chosen definition that
inhibits hyphenation, but lets it occur if the argument
contains both a language and font change, or a discretionary.

So let me make my question clear: I was wondering why this
method was chosen, and was wondering if there were any side
effects that I was unaware of. If not, I can conclude they
wanted to inhibit hyphenation, but wanted to allow it
at discretionaries. (I imagine that no one would likely change
font and language.)

Donald Arseneau

unread,
Nov 9, 2010, 4:32:40 PM11/9/10
to
Dan Luecking <Look...@uark.edu> writes:

> On 05 Nov 2010 11:44:56 -0700, Donald Arseneau <as...@triumf.ca> wrote:
>
> >GL <goua...@gmail.com> writes:
> >
> >> > This seems strange to me. Does setting \hyphenchar\font
> >> > to -1 do anything important except turn off hyphenation?
> >
> >What do you mean by important? Its detailed behaviour is
> >different from other methods.
>
> OK: does it have a purpose inside the definition of \meta
> apart from inhibiting hyphenation?

Not that I know of.

> >> > Does setting \language to \l@nohyphenation do anything
> >> > important except turn off hyphenation? Are both needed?

Now I see what you (GL?) mean by " Are both needed?"

> The authors of \meta seems to have chosen definition that
> inhibits hyphenation, but lets it occur if the argument
> contains both a language and font change, or a discretionary.

Also, the \hyphenchar=-1 is important on installations
where the "nohyphenation" language was not built into the
format (latex.fmt).

> So let me make my question clear: I was wondering why this
> method was chosen, and was wondering if there were any side
> effects that I was unaware of. If not, I can conclude they
> wanted to inhibit hyphenation, but wanted to allow it
> at discretionaries. (I imagine that no one would likely change
> font and language.)

I can't speak for the authors, but I guess the two settings are a
belt-and-suspenders solution.


--
Donald Arseneau as...@triumf.ca

Marc van Dongen

unread,
Nov 10, 2010, 8:36:47 AM11/10/10
to
On Nov 2, 9:25 am, Thomas Arildsen <tha.es-aau...@spamgourmet.com>
wrote:

> I am trying to figure out the correct way to enter angle brackets in
> LaTeX text mode. Entering < and > directly translates into completely

Hi,

amsmath is your friend when it comes to entering text in math mode:

\usepackage{amsmath}

$\langle\text{YOUR TEXT HERE}\rangle$

Note that the \langle and \rangle are already quite high as delimiters
of text expressions, which is why I didn't use \left\langle and \right
\rangle.

Regards,


Marc van Dongen

Bob Tennent

unread,
Dec 22, 2010, 9:52:35 AM12/22/10
to
On 02 Nov 2010 09:25:36 GMT, Thomas Arildsen wrote:
> I am trying to figure out the correct way to enter angle brackets in
> LaTeX text mode.

\usepackage{textcomp}

\textlangle \textrangle

http://www.ctan.org/tex-archive/info/symbols/comprehensive/

Bob T.

Aisha27Nguyen

unread,
Dec 22, 2010, 9:20:53 AM12/22/10
to
I took my first <a href="http://bestfinance-blog.com/topics/personal-loans">personal loans</a> when I was 25 and this aided my relatives a lot. But, I need the collateral loan once more time.


0 new messages