COMPGROUPS.NET | Search | Post Question | Groups | Stream | About | Register

Angle brackets in text mode

• Follow

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

 0

Thomas Arildsen <tha.es-aau-dk@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.
>
> Thomas Arildsen

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

Ciao
Enrico

 0

On 2010-11-02 10:25, Thomas Arildsen 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.

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

/August

 0

Enrico Gregorio <Facile.da.trovare@in.rete.it> writes:

> Thomas Arildsen <tha.es-aau-dk@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

 0

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

 0

Robin Fairbairns <rf10@sxp10.cl.cam.ac.uk> wrote:

> Enrico Gregorio <Facile.da.trovare@in.rete.it> writes:
>
> > Thomas Arildsen <tha.es-aau-dk@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...

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

 0

On Tue, 02 Nov 2010 12:02:53 +0100, August Karlstrom wrote:

> 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

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

Thomas Arildsen

 0

On Tue, 02 Nov 2010 11:48:06 +0100, August Karlstrom wrote:

> On 2010-11-02 10:25, Thomas Arildsen 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.
>
> In what (semantical) context do you want to use angle brackets?
>
>
> /August

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

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

Best regards,
Thomas Arildsen

 0

Le 03/11/2010 10:43, Thomas Arildsen a écrit :
> On Tue, 02 Nov 2010 11:48:06 +0100, August Karlstrom wrote:
>
>> On 2010-11-02 10:25, Thomas Arildsen 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.
>>
>> In what (semantical) context do you want to use angle brackets?
>>
>>
>> /August
>
> 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.

>
> Best regards,
> Thomas Arildsen


 0

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

 0

On Wed, 03 Nov 2010 13:40:48 +0100, GL <gouailles@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

 0

Le 05/11/2010 17:52, Dan Luecking a �crit :
> On Wed, 03 Nov 2010 13:40:48 +0100, GL<gouailles@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?

\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 ...

> 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


 0

GL <gouailles@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                          asnd@triumf.ca

 0

On Fri, 05 Nov 2010 18:01:55 +0100, GL <gouailles@gmail.com> wrote:

>Le 05/11/2010 17:52, Dan Luecking a �crit :
>> On Wed, 03 Nov 2010 13:40:48 +0100, GL<gouailles@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?
>
>\hypenchar\font=-1 does not turn hyphenation off, but set
>the hyphen character to an empty character.

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
To reply by email, change LookInSig to luecking

 0

On 05 Nov 2010 11:44:56 -0700, Donald Arseneau <asnd@triumf.ca> wrote:

>GL <gouailles@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.)

Dan
To reply by email, change LookInSig to luecking

 0

Dan Luecking <LookInSig@uark.edu> writes:

> On 05 Nov 2010 11:44:56 -0700, Donald Arseneau <asnd@triumf.ca> wrote:
>
> >GL <gouailles@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                          asnd@triumf.ca

 0

On Nov 2, 9:25=A0am, 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

 0

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

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.

 0

18 Replies
1932 Views

Similiar Articles:

7/19/2012 4:25:59 PM