Is there such a thing as a non-breaking underscore?

This forum is for all Flare issues related to PDF, eBook, Microsoft Word, Adobe FrameMaker, XPS, and XHTML book targets.

Is there such a thing as a non-breaking underscore?

Postby ChoccieMuffin on Wed Mar 29, 2017 4:31 am

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.

:)
Started as a newbie with Flare 6.1, now using Flare 2019r1 and 2020.
Report bugs at http://www.madcapsoftware.com/bugs/submit.aspx.
Request features at https://www.madcapsoftware.com/feedback ... quest.aspx
ChoccieMuffin
Senior Propellus Maximus
 
Posts: 2429
Joined: Wed Apr 14, 2010 8:01 am
Location: Surrey, UK

Re: Is there such a thing as a non-breaking underscore?

Postby ChoccieMuffin on Fri Apr 21, 2017 9:06 am

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?
Started as a newbie with Flare 6.1, now using Flare 2019r1 and 2020.
Report bugs at http://www.madcapsoftware.com/bugs/submit.aspx.
Request features at https://www.madcapsoftware.com/feedback ... quest.aspx
ChoccieMuffin
Senior Propellus Maximus
 
Posts: 2429
Joined: Wed Apr 14, 2010 8:01 am
Location: Surrey, UK

Re: Is there such a thing as a non-breaking underscore?

Postby SKamprowski on Mon Apr 24, 2017 1:27 am

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.
Kind regards,
Sabine Kamprowski
DocToHelp MVP (by ComponentOne)
SKamprowski
Sr. Propeller Head
 
Posts: 265
Joined: Fri Feb 13, 2015 8:25 am
Location: Germany

Re: Is there such a thing as a non-breaking underscore?

Postby Feebeegeebee on Mon Apr 24, 2017 2:30 am

have you ever considered to use "custom hyphenation" for your words.


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.
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 2020 on Windows 10 (64-bit)
------------------------------------------------------
Feebeegeebee
Sr. Propeller Head
 
Posts: 182
Joined: Wed Aug 08, 2012 8:38 am
Location: UK

Re: Is there such a thing as a non-breaking underscore?

Postby King_Haggard on Tue Dec 03, 2019 1:49 am

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:

  • Create a new span in your stylesheet:

span.subscript

{

vertical-align: sub;

letter-spacing: -2px;

}

  • Create another span:

span.subscript_2

{

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.
You can create a new snippet with the three characters for future use.
King_Haggard
Jr. Propeller Head
 
Posts: 3
Joined: Thu Nov 28, 2019 8:12 am

Re: Is there such a thing as a non-breaking underscore?

Postby ChoccieMuffin on Wed Dec 11, 2019 8:23 am

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! :lol:
Started as a newbie with Flare 6.1, now using Flare 2019r1 and 2020.
Report bugs at http://www.madcapsoftware.com/bugs/submit.aspx.
Request features at https://www.madcapsoftware.com/feedback ... quest.aspx
ChoccieMuffin
Senior Propellus Maximus
 
Posts: 2429
Joined: Wed Apr 14, 2010 8:01 am
Location: Surrey, UK

Re: Is there such a thing as a non-breaking underscore?

Postby Chicago_HPT on Thu Dec 12, 2019 1:03 pm

.
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;
}

Then to implement it, simply span the text you don't want to wrap, for example:
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>

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
Chicago_HPT
Sr. Propeller Head
 
Posts: 100
Joined: Sun Feb 03, 2013 6:01 pm

Re: Is there such a thing as a non-breaking underscore?

Postby oceanclub on Tue Feb 04, 2020 3:21 am

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.
User avatar
oceanclub
Sr. Propeller Head
 
Posts: 233
Joined: Thu Oct 10, 2013 4:45 am
Location: Dublin


Return to Printed Documentation Targets

Who is online

Users browsing this forum: Google [Bot] and 8 guests

cron