I have assorted items in my documents that are sets of letters separated by underscores (for example VAR_M, or CR_MINV_VNP). When one of these items appears at the end of a line I want the whole thing to move to the next line rather than break at the underscore. It would be so much easier if they were hyphens, then I could use a non-breaking hyphen! (I tried including the item inside a div within the paragraph but that didn't work as the item just appeared on its own line.)
At the moment I'm having to do this manually by inserting a linefeed before the item, but that then hard-codes a linefeed which doesn't look good in my online output.
Is there any way to force these items to always stay together? For example a non-breaking underscore? Any suggestions welcome.
Is there such a thing as a non-breaking underscore?
-
- Senior Propellus Maximus
- Posts: 2632
- Joined: Wed Apr 14, 2010 8:01 am
- Location: Surrey, UK
Is there such a thing as a non-breaking underscore?
Started as a newbie with Flare 6.1, now using Flare 2023.
Report bugs at http://www.madcapsoftware.com/bugs/submit.aspx.
Request features at https://www.madcapsoftware.com/feedback ... quest.aspx
Report bugs at http://www.madcapsoftware.com/bugs/submit.aspx.
Request features at https://www.madcapsoftware.com/feedback ... quest.aspx
-
- Senior Propellus Maximus
- Posts: 2632
- Joined: Wed Apr 14, 2010 8:01 am
- Location: Surrey, UK
Re: Is there such a thing as a non-breaking underscore?
Well I see there was no response to my question so I'm not in the least bit surprised to discover that there isn't such a thing as a non-breaking underscore, confirmed by MadCap Tech Support.
That leads me to my second question which is, do any of you have a suggestion on how I can force a bit of text (e.g. CR_MINV_VNP) NOT to break? I tried wrapping it in a div (no go, divs don't work like that) and the only thing I'm left with is to insert a linefeed before the offending item.
Any suggestions? Or am I just, as they say, stuffed?
That leads me to my second question which is, do any of you have a suggestion on how I can force a bit of text (e.g. CR_MINV_VNP) NOT to break? I tried wrapping it in a div (no go, divs don't work like that) and the only thing I'm left with is to insert a linefeed before the offending item.
Any suggestions? Or am I just, as they say, stuffed?
Started as a newbie with Flare 6.1, now using Flare 2023.
Report bugs at http://www.madcapsoftware.com/bugs/submit.aspx.
Request features at https://www.madcapsoftware.com/feedback ... quest.aspx
Report bugs at http://www.madcapsoftware.com/bugs/submit.aspx.
Request features at https://www.madcapsoftware.com/feedback ... quest.aspx
-
- Sr. Propeller Head
- Posts: 277
- Joined: Fri Feb 13, 2015 8:25 am
- Location: Germany
Re: Is there such a thing as a non-breaking underscore?
Hi ChoccieMuffin,
have you ever considered to use "custom hyphenation" for your words.
I assume you did, still I wonder why this is not a solution.
have you ever considered to use "custom hyphenation" for your words.
I assume you did, still I wonder why this is not a solution.
Kind regards,
Sabine Kamprowski
DocToHelp MVP (by ComponentOne)
Sabine Kamprowski
DocToHelp MVP (by ComponentOne)
-
- Sr. Propeller Head
- Posts: 213
- Joined: Wed Aug 08, 2012 8:38 am
- Location: UK
Re: Is there such a thing as a non-breaking underscore?
I think that if you highlight a word/phrase that has an underscore in it and try to create a custom rule, only the part before the underscore will be treated as a word.have you ever considered to use "custom hyphenation" for your words.
So, for example, for "MY_CUSTOM_PARAMETER" I think the rule would only be applied to "MY".
However, would it be an option to highlight the paragraph containing your word and try Format > Paragraph > Hyphenation and under Enable Hyphenation choose Never?
Feebeegeebee
-----------------------------------------------------
Using Flare 2022 on Windows 11 (64-bit)
-----------------------------------------------------
Using Flare 2022 on Windows 11 (64-bit)
-----------------------------------------------------
-
- Jr. Propeller Head
- Posts: 4
- Joined: Thu Nov 28, 2019 8:12 am
Re: Is there such a thing as a non-breaking underscore?
It is possible to fake a non-breaking underscore by repurposing three non-breaking hyphens and do some stylesheet magic. With this method you format the hyphens as subscript and remove the gap between the first two hyphens (but not between the last hyphen to the following character).
What you need to do:
{
vertical-align: sub;
letter-spacing: -2px;
}
{
vertical-align: sub;
}
What you need to do:
- Create a new span in your stylesheet:
{
vertical-align: sub;
letter-spacing: -2px;
}
- Create another span:
{
vertical-align: sub;
}
- Insert three non-breaking hyphens in the text where you want your non-breaking-underscore to be.
- Assign span.subscript to the first two hyphens.
- Assign span.subscript_2 to the last hyphen.
-
- Senior Propellus Maximus
- Posts: 2632
- Joined: Wed Apr 14, 2010 8:01 am
- Location: Surrey, UK
Re: Is there such a thing as a non-breaking underscore?
That sounds like a really cool fix, but unfortunately it would mean that a user who copies from my output would then have MY---ITEM rather than MY_ITEM. But I do like your thinking!
Started as a newbie with Flare 6.1, now using Flare 2023.
Report bugs at http://www.madcapsoftware.com/bugs/submit.aspx.
Request features at https://www.madcapsoftware.com/feedback ... quest.aspx
Report bugs at http://www.madcapsoftware.com/bugs/submit.aspx.
Request features at https://www.madcapsoftware.com/feedback ... quest.aspx
-
- Sr. Propeller Head
- Posts: 133
- Joined: Sun Feb 03, 2013 6:01 pm
Re: Is there such a thing as a non-breaking underscore?
.
Is this for online only, or do you have a print output as well?
I've had some good success for HTML5 output using the CSS white-space property, with a value of pre. I set up a span style as follows:
Then to implement it, simply span the text you don't want to wrap, for example:
The first line should break after "adipiscing elit." Unfortunately, I haven't had much luck using white-space for print (PDF) output.
I hope that helps,
-jeff
Is this for online only, or do you have a print output as well?
I've had some good success for HTML5 output using the CSS white-space property, with a value of pre. I set up a span style as follows:
Code: Select all
span.no-wrap
{
white-space: pre;
}
Code: Select all
<p class="bodyText">Lorem ipsum dolor sit amet, consectetur adipiscing elit. <span class="no-wrap">Etiam augue nulla, convallis vel gravida at, feugiat</span> in dui. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nunc congue nec purus sit amet eleifend. Nulla euismod ex a cursus convallis.</p>
I hope that helps,
-jeff
Re: Is there such a thing as a non-breaking underscore?
Is there really no proper fix for this? It's a problem developers have highlighted in our documentation that variable names containing underscores are breaking across two lines.
P.
P.