Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Mathematica "\<...\>" syntax

In an answer to another SO question, passing mention was made to a Mathematica string escape syntax that looks like this: "\<...\>". Apparently, this syntax is useful for dealing with embedded newlines in strings. I've tried searching for documentation using various terms in the Mathematica help browser (and Google), but to no avail. Where can I find documentation on this syntax?

Answer Summary

@Mark points out that the construct is documented in Section 2.8.6 of the V5 Mathematica book. It is also mentioned in Section 2.8.7 of the V5.2 Mathematica Book. In both of those locations, the documentation states that Mathematica ignores line breaks and following tabs in strings -- unless they are enclosed between \< and \> in which case the line breaks (but not tabs) are retained.

In the corresponding section of the V6 documentation, it states that line breaks are retained in strings. Therefore, it appears that the escape syntax is no longer needed starting in V6 -- and is therefore no longer documented.

Note that many notebooks still use this syntax internally, even in V8. @Alexey points out that the cell expressions for strings that contain line breaks still use the syntax.

like image 500
WReach Avatar asked May 19 '11 23:05

WReach


People also ask

What does := mean in Mathematica?

to clear a value) x == val — test equality or represent a symbolic equation (!= for unequal) lhs := rhs — function etc.

How do you write a suffix in Mathematica?

Type a subscript with (Insert ▶ Typesetting ▶ Subscript). Exit from typing math with : Exit from a subscript but continue typing math with (Insert ▶ Typesetting ▶ End Subexpression): Typing a subscript in text automatically enters math mode.

What is complex expand?

▪ Putting Expressions into Different Forms. Expressions Involving Complex Variables.


1 Answers

It's mentioned briefly in section 2.8.6 of the most recent edition of The Mathematica Book. Of course, that's for V5 of Mathematica. In fact, I just tried the following in both V5.2 and V6.0.3:

"Hi
There"

The results were quite different. In particular, V5.2 returned a single line, with no newline character. V6.0.3 returned two lines with the newline character formatted as expected. Strings were improved considerably in V6, so perhaps the `"\<...\>" construct is no longer required.

And perhaps I've been using Mathematica for way too long. :)

like image 76
Mark McClure Avatar answered Sep 22 '22 16:09

Mark McClure