Re: Cell["\<\ ... \>", ... ; TextData[...]

• To: mathgroup at smc.vnet.net
• Subject: [mg114790] Re: Cell["\<\ ... \>", ... ; TextData[...]
• From: Derek Yates <yatesd at me.com>
• Date: Fri, 17 Dec 2010 03:28:50 -0500 (EST)
• References: <iecr3r\$bnb\$1@smc.vnet.net>

```I did find a reference to this in some of the legacy Mathematica
(version 5.2) documentation.

2.8.7 Advanced Topic: Newlines and Tabs in Strings
http://reference.wolfram.com/legacy/v5_2/book/section-2.8.7

John Fultz mentioned that the kernel simply ignores the delimiters,
however I noticed that the kernel's interpretation of a raw string is
still affected. As he mentioned, it is essentially legacy, as the
front-end no longer inserts raw strings into cells the way the 5.2
documentation mentions, but you can still see the behaviour if you try
editing a Cell expression (Cell > Show Expression) as follows:

type a few characters (I entered qwerty) in an empty cell in the front-
end, and then do Cell > Show Expression, and you will see something
like this:
Cell[BoxData["qwerty"], "Input"]

replace it with:

Cell["qw
erty","Input"]

where you have put the new line in using the Return key. Now when you
revert the Show Expression, you will see

qw erty

in the cell.

If you edit the cell expression again so that it is
Cell["\<qw
erty\>","Input"]

Then you will see

qw
erty

in the cell.

Here is an excerpt from the documentation. Note that the example they
show does not work in new versions of Mathematica, but my example
above showed how to create it artificially.

"When you enter a long string in Mathematica, it is often convenient
to break your input across several lines. Mathematica will by default
ignore such breaks, so that if you subsequently output the string, it
can then be broken in whatever way is appropriate.

Mathematica ignores the line break and any tabs that follow it.
In:=  "A string on
two lines."

Out=  A string on two lines

There is no newline in the string.
In:=  InputForm[%]
Out//InputForm=
"A string on two lines."

Input forms for strings:
"text"  line breaks in text are ignored
"\<text\>"  line breaks in text are stored explicitly as \n

Here Mathematica keeps the newline
In:=  "\<A string on
two lines.\>"

Out=
A string on
two lines

In InputForm, the newline is shown as an explicit \n.
In:=  InputForm[%]

Out//InputForm=
"a string on\ntwo lines."

```

• Prev by Date: Re: VectorPlot on a Circle
• Next by Date: Re: Cell["\<\ ... \>", ... ; TextData[...]
• Previous by thread: Re: VectorPlot on a Circle
• Next by thread: Re: Cell["\<\ ... \>", ... ; TextData[...]
{"ft_lang_label":"__label__en","ft_lang_prob":0.8289201,"math_prob":0.60225743,"size":2364,"snap":"2021-31-2021-39","text_gpt3_token_len":617,"char_repetition_ratio":0.119491525,"word_repetition_ratio":0.05235602,"special_character_ratio":0.27622673,"punctuation_ratio":0.17234468,"nsfw_num_words":0,"has_unicode_error":false,"math_prob_llama3":0.9527909,"pos_list":[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14],"im_url_duplicate_count":[null,null,null,null,null,null,null,null,null,null,null,null,null,null,null],"WARC_HEADER":"{\"WARC-Type\":\"response\",\"WARC-Date\":\"2021-09-29T01:32:11Z\",\"WARC-Record-ID\":\"<urn:uuid:e674427a-4e7b-4cd7-b747-392889690ab1>\",\"Content-Length\":\"46343\",\"Content-Type\":\"application/http; msgtype=response\",\"WARC-Warcinfo-ID\":\"<urn:uuid:0508790b-4a85-4d54-a53b-4be48d979206>\",\"WARC-Concurrent-To\":\"<urn:uuid:3b080cd1-9564-4f79-b518-deccb9c40587>\",\"WARC-IP-Address\":\"140.177.205.73\",\"WARC-Target-URI\":\"https://forums.wolfram.com/mathgroup/archive/2010/Dec/msg00483.html\",\"WARC-Payload-Digest\":\"sha1:PPFGVAD62ABUQIH7KPSDGVTZLLLPJSWP\",\"WARC-Block-Digest\":\"sha1:YGHD6UIEZKJAHLDCM6ZSWGIU5BNBL4AO\",\"WARC-Identified-Payload-Type\":\"text/html\",\"warc_filename\":\"/cc_download/warc_2021/CC-MAIN-2021-39/CC-MAIN-2021-39_segments_1631780061350.42_warc_CC-MAIN-20210929004757-20210929034757-00461.warc.gz\"}"}