Skip to main content
23-Emerald V
September 10, 2025
Question

Problem Report - newline character no longer works in a string

  • September 10, 2025
  • 5 replies
  • 1132 views

I was just playing around with the function format to see if I could create a readable, compact form that displays the values of variables in an expression.   To do this, I wanted to use the Unicode character point 10 or 13 to generate a newline.   This worked in Prime 10, and I'd previously used it to create string justification functions, such as:

 

2025 09 10 D.png

 

Mathcad Prime 11 has broken this behaviour.  I now get:

 

2025 09 10 E.png

 

Why did PTC do this?  Is it a bug that got introduced, or was it deliberate?  If the latter, what benefits accrue to the user that outweigh the loss of functionality?

 

I've been requesting more sophisticated strings since before Mathcad Prime was developed and throughout its entire existence—for example, HTML or RTF.   Taking even such a limited capability away is irritating in extremis.

 

Stuart

 

@DJNewman , @amcgough 

 

5 replies

23-Emerald V
September 19, 2025

For the record, here's an example of the use of CR and/or LF that I posted almost 4 years ago (Prime 7, I think), so it's been in use for several versions of Prime and documented as having been used:

 

https://community.ptc.com/t5/Mathcad/Feature-Request-Remove-quotes-from-strings-in-format-function/m-p/749778/highlight/true#M197367

 

2021 09 23 A.png

 

Here's a herd of Prime Milchkühe in 10.0.1.0 ...

 

2025 09 18 B.png

 

And here's the same herd after being hit Cowvid Prime 11:

 

2025 09 18 C.png

 

 

Prime 7..10

 

2025 09 18 D.png

 

Prime 11:

 

2025 09 19 A.png

 

I feel somewhat like Emperor Joseph II in Amadeus when watching ballet without music.

 

Let's give Dr Buttercup Banner the last word .., 

 

2025 09 18 E.png

 

Stuart

 

23-Emerald V
September 23, 2025

Somewhere in PTC Central, the minion in charge of Excluding Bruff's Beneficial Features is being summoned as we speak.  After a formal shaming, they will be ceremoniously dragged by wild tortoises to a place of execution, where they will commit ritual seppuku with a blunt parenthesis.  Their crime?  They let a Useful Feature slip through the net!

 

2025 09 23 G.png

 

Stuart

 

Spoiler
StuartBruff_0-1758649177883.png

 NEL: Next Line, U+0085 (133)
 LS: Line Separator, U+2028 (8232)
 PS: Paragraph Separator, U+2029 (8233)
23-Emerald IV
September 23, 2025

Works like a charm, also in previous Prime versions.

However, Mathcad will allow only codes up to 255, and produces an ellipsis "..." at the lower of the three:LucMeekes_0-1758660517254.png

 

Luc

23-Emerald V
September 20, 2025

And another instance (worked in Prime 7, IIRC😞

 

Mathcad Prime 10:

 

2025 09 20 C.png

 

Mathcad Prime 11:

 

2025 09 20 D.png

 

Stuart

23-Emerald IV
September 20, 2025

(Also) for the record: This is what Mathcad 11 gives:

LucMeekes_0-1758388707802.png

We've been requesting since Prime1 that the functionality of (real) Mathcad would be supported by Prime.

Guess this is what you get...

 

Luc

 

23-Emerald V
September 20, 2025

Inderdaad, Luc.

 

I feel like I am the first half of St John's statement in John 1:23, "De stem van een die roept in de woestijn"

 

I understand that different people will have different ideas about what Mathcad is and should be, but I'm not convinced that breaking existing capability to meet a/several user needs is the best way to go.  I really don't understand why the CR/LF string line breaking was removed and what benefits we accrue from its removal.

 

And further for the record:

 

2025 09 20 E.png

 

vs (your)

 

2025 09 20 F.png

 

Stuart

23-Emerald V
September 21, 2025

It appears that I reported the existence of this Prime feature back in 2015.

 

https://community.ptc.com/t5/Mathcad/Prime-string-control-characters-actually-do-something/m-p/295606

 

Well, I had expressed the hope that it was a feature, not a bug, to be removed.  It only took 10 years, but I guess I have my answer.  ðŸ˜¢

 

Stuart

 

2025 09 21 A.png

25-Diamond I
September 21, 2025

I remember that years back I tried to use these characters in real Mathcad and it failed.
I seem to have missed your post 10 years ago and also the fact that some of them worked in Prime up to version 10.

Just gave it a try and noticed that BS(8) and BEL(7) don't work in Prime10 either, here vec2str already throws an error as of invalid character.
So Luc is correct when he notes that the behaviour in Prime 11 is identical to the behaviour in old Mathcad when it comes to displaying strings.

 

I could understand that Prime 10 removed the option of converting a range into a vector through simple inline evaluation, since evaluation should not cause any changes to the variables, especially not their data type.
But I can't think of a reasonable reason for removing the option to display CR, LF when evaluating strings. Its sure not something I would use every day but something which could be handy occasionally. I don't see any added value in disabling this 'feature'.
It's only about the display during evaluation—the special characters are still present in the string, as an evaluation of str2vec shows.

Werner_E_0-1758474284851.png

TAB seems still be allowed to display

23-Emerald V
September 21, 2025

I imagine one of two scenarios existed:

 

1.  Somebody saw I was using the feature and invoked the Bruff Exclusion Rule, whereby anything I find useful or want is excluded at the earliest opportunity.

 

2.  Somebody, a user, got confused.  So the feature was removed rather than, say, suggesting that they apply a filter to their string to remove any characters they didn't like.   (The latter would have been the better option, as people who do use the feature cannot apply a filter to restore the capability (but see Scenario 1)).

 

This has been the default go-to scenario since Mathsoft ran the show.  Tom Gutman introduced me to the term "Nannyware" to describe such an approach.  There was one particular Mathsoft change that had me gibbering and hooting like a demented chimp on a flinging spree - I wish I could remember what it was (well, OK, there have been multiple changes that have induced that behaviour in me, the current subject being another one).

 

The fact that Tab (09) functionality still exists suggests that a third scenario, fixed in a general clean-up, probably didn't happen.

 

For control codes that don't have a reasonable interpretation under a virtual document rendition, there are always the Unicode symbols:

 

2025 09 21 F.png

 

A far more sensible approach, IMO, but what would I know?

 

Stuart

 

... Ah, yes.  A user complained that Mathcad crashed when running a recursive function that had no termination condition. So, instead of fixing the problem, Mathsoft added a recursion depth limit of around 4000, on the basis that who would ever want a recursion depth of more than that?  I mean, that would be silly.  Naturally, as one who regularly exceeded that depth, I whined like a whiny thing that had a special reason to whine (and I did have one).  The response?  Apparently, I could play with the Registry and set my own limit. 

 

Again, I howled, pleaded, and wheedled to get a proper fix, using the pathetic excuse that setting Registry values wasn't exactly portable and many organisations forbade users (or anyone!) from playing with the Registry upon pain of termination; for monsters could be summoned if the mages cast an improper spell upon the Registry.  Would it not be better, I urged, to fix the problem by at least keeping an eye on the stack, and educating users on the need to write correct recursive programs?

 

Last I looked, the recursion depth limit was still there.  Yep, still there at 4766.  A very annoying limit (especially for those who use Express, which isn't exactly a selling point).

 

2025 09 21 G.png

 

Heck, we haven't even got mutual recursion as a consolation prize.

 

Still, somebody must have noticed that I did actually use the Registry fix for recursion depth - see Scenario 1; if it's still in the Registry, I can't find it.

23-Emerald IV
September 21, 2025

According to help:

vec2str(v)—Converts a vector of UNICODE codes in v to a string. This function also works with zero-length strings, such as vec2str(0) = "".

v is a vector of integers representing UNICODE code points for any valid string character. Acceptable values are integers in the range 9, 10, 13, or 32 - 255.

Indeed:

LucMeekes_0-1758476957084.png

 Note that the argument to vec2str is NOT a vector of real numbers here.

And it seems to require that, except when the 'vector' is 0, instead of [0].:

LucMeekes_1-1758476969513.png

(Value must be a vector of real numbers.)

ok:

LucMeekes_2-1758477020107.png

but:

LucMeekes_3-1758477053044.png

(String cannot be computed because it contains an invalid character.)

In mathcad:

LucMeekes_5-1758477171213.png

I'd say, Prime is on its way to meet Mathcad, but it's not there yet.

 

Luc