Text Line Break also is a Page Break.

Hi,

According to my understanding (and HTML br tag)
“Line Break” - force line break, not to separate paragraph.

I have an issue with “Line Break”. Both \n and
give paragraph break. I’m using TMP 2.0.1
How a can break line without paragraph break (similar to SHIFT+ENTER in rich text editors)
4732586--448313--upload_2019-7-10_17-43-30.png

Unfortunately I’m pretty sure the only thing TextMesh counts as a “new line” instead of a “new paragraph” is a newline caused by word wrapping.

This is a quote from the documentation “Paragraphs are defined by explicit line breaks”.
You can find the quote here under “Spacing Options” Text Components, TextMesh Pro Documentation

Side note: “\r” seems to draw a new line of text over the current line of text, and isn’t affected by spacing. Doesn’t seem very helpful. :eyes:

1 Like

The escape character \n or Line Feed indicate the end of a line of text and start of a new one. It also represents the end of a paragraph or hard line break.

The
tag is an html convention used to introduce a line break or new line which is the same as \n.

The escape character \r or Carriage Return simply return the carriage back to the start of the line but without adding a new line. This is the purpose of that control character.

The following text “This is the first line of text.\nThis is the second line of text.” produces the following results.

As you can see the use of \n does not introduce an additional line.

Perhaps in your original text, the text already contained a line feed + the extra \n resulting in the extra line.

P.S. In the Inspector text input box, it is easier to simply press Enter to insert a line feed rather than using \n. In strings however, \n is the way to go.

Hi, @Stephan_B

“As you can see the use of \n does not introduce an additional line.” - Yes, it does not introduce an additional line.
But as you can see from the picture, I have SpacingOption/Paragraph=50.
In conventional rich text editor I can control “line break” and “paragraph break”.
Seems @MSplitz-PsychoK is right, in TextMesh Pro “Paragraphs are defined by explicit line breaks.”

I just looked into this briefly and ran into the following challenge.

Here is an image from Microsoft Word with Paragraph and delimiters set to visible.

4737614--449078--upload_2019-7-11_12-43-2.png

Selecting this text to check the ASCII values produces “65, 66, 67” which is as expected.

Next pressing Enter after the letter B produces the following image.

4737614--449081--upload_2019-7-11_12-44-56.png
Checking the ASCII values of the result produces the following ASCII sequence “65, 66, 13, 10, 67” which is also as expected.

Next instead of pressing Enter after the B, this time I pressed Shift Enter to insert a soft line break.

4737614--449087--upload_2019-7-11_12-48-36.png
Checking the ASCII values again produced the following ASCII sequence “65, 66, 13, 10, 67” which is identical to the previous sequence.

The challenge here is the fact there is no differentiation between these two.

Looking like \v which is a vertical tab does insert a soft line break just like using Shift Enter in word. So I could certainly consider adding support for \v.

Thoughts?

P.S. Shift Enter is not currently supported in text fields in the Unity editor which could be explored to make it easier to enter the equivalent to \v.

4 Likes

Hey, @Stephan_B

I very appreciate you took another look on this.
Yes, \v is a good choice.

I get some backups for that:
Historical retrospective: WD: Text Only Format Converts ASCII 11 to ASCII 13
While it called “manual line break”: Redirecting
It is vertical tab: How Do I Insert A Line Break To A Word Document Programatically? | Microsoft Learn

Pardon me to dig an old thread.

I’m surprised that I’m not aware of \v exist despite I’m using Unity and TMP for ~8 years! And it is working in 2022!
Along side with useful secret tags which appear briefly only in Stephan_B’s thread or in TMP change note.

Which the one is super important for some Asian language to manually insert word break point like Thai. (like “สวัสดีครับ”) I saw newcomers in our community always ask how to manually insert word break point all the time, because they don’t aware of these secret tags at all.

I suggest @Stephan_B to maybe update those well known landing pages from Google search like:

https://docs.unity3d.com/Packages/com.unity.textmeshpro@4.0/manual/RichText.html

I don’t know if you still have control to content in these links or they already obsolete, but yeah I it was from my experience as user and I think 70% of users will land on above pages for reference from search result most of the time. (which did not contain info for valuable \v or secret tags secret tags at all)

The first link is where I landed and use for reference the most.

1 Like

agree! Same thing here!