prevent line breaks at hyphens

This forum is for all Flare issues related to styles, stylesheets and XML.
Post Reply
pdenchfield
Propellus Maximus
Posts: 574
Joined: Tue Oct 03, 2006 7:56 am
Location: Seattle, WA
Contact:

prevent line breaks at hyphens

Post by pdenchfield »

Is there a way to prevent lines from breaking at hyphens? Right now my autofit table automatically shrinks column width to where the hyphens appear, as shown in the attached image.

I want to make my autofit table expand this column to the full paragraph "nm-data-created-date."

Thanks!
You do not have the required permissions to view the files attached to this post.
Rene Severens
Sr. Propeller Head
Posts: 210
Joined: Mon Sep 19, 2011 2:06 am
Location: Netherlands - Zoetermeer
Contact:

Re: prevent line breaks at hyphens

Post by Rene Severens »

Hi,

Does it work if you use a non-breaking hyphen?

Menu Symbols - insert character - Non-Breaking Hyphen

Greetings,
René Severens
"The numbers are strange today; they somehow do not seem to add up."
ChoccieMuffin
Senior Propellus Maximus
Posts: 2632
Joined: Wed Apr 14, 2010 8:01 am
Location: Surrey, UK

Re: prevent line breaks at hyphens

Post by ChoccieMuffin »

Question along the same lines - is there such a thing as a non-breaking underline? I have a number of items like C_RES_IMG, and I don't want a line to break at the underscore. Any suggestions?
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
Rene Severens
Sr. Propeller Head
Posts: 210
Joined: Mon Sep 19, 2011 2:06 am
Location: Netherlands - Zoetermeer
Contact:

Re: prevent line breaks at hyphens

Post by Rene Severens »

Hi,

No, that does not exist as far as I know. However, there is a "workaround", depending on the used flare version.

If you use flare 9 it will work as expected. But in higher versions of flare it will not work.

The reason is the PRE-tag bug. According to MadCap, in flare version 9 it was programmed with an error. This error has been corrected in higher versions, resulting in the different functionality, so not working as expected anymore.

I am still using flare 9 for this reason, because in my documentation there is a lot of XML that contains several lines of attributes that have "-" and "_" in their names.

Greetings,
René Severens
"The numbers are strange today; they somehow do not seem to add up."
pdenchfield
Propellus Maximus
Posts: 574
Joined: Tue Oct 03, 2006 7:56 am
Location: Seattle, WA
Contact:

Re: prevent line breaks at hyphens

Post by pdenchfield »

Resolved! Non-breaking hyphens fixed the issue. Thanks!
chrispitude
Propeller Head
Posts: 58
Joined: Thu Mar 23, 2017 12:23 pm

Re: prevent line breaks at hyphens

Post by chrispitude »

pdenchfield wrote:Resolved! Non-breaking hyphens fixed the issue. Thanks!
I write documentation for a software company. I also have issues with line breaks occurring at hyphens -- particularly, for the leading hyphens when describing options of commands. For example,

Code: Select all

command -option1 -option2 -
option3 option 4
A nonbreaking hyphen fixes the issue cosmetically. However, it is still a different character than a hyphen. This means:
  • If the user types "-option3" into a search dialog box in their media viewer (PDF, HTML5, etc.), there will be no match because a hyphen does not match a nonbreaking hyphen.
  • If they copy and paste the example from the media to their terminal window, they will get a syntax error (same reason).
  • Examples and references would require painful conversion from hyphens to nonbreaking hyphens.
Is there a better way to handle this?
Feebeegeebee
Sr. Propeller Head
Posts: 213
Joined: Wed Aug 08, 2012 8:38 am
Location: UK

Re: prevent line breaks at hyphens

Post by Feebeegeebee »

If the user types "-option3" into a search dialog box in their media viewer (PDF, HTML5, etc.), there will be no match because a hyphen does not match a nonbreaking hyphen.
Just a couple of thoughts for this one that might be worth trying...

* If it's just a single word that includes the non-breaking hyphen, could you enter it as a synonym? If you can enter "-option3" with a normal hyphen and "-option3" with a non-breaking hyphen as synonyms, the search should pick it up when the user enters the term in the search field.

* Alternatively, if you go to the Text Editor, you could include the original term (with an ordinary hyphen) in the body of the page as hidden text. That way it is not visible to the user in the HTML output, but will get picked up by the search.
I have done this previously by entering a term as an index keyword on the page, which then gets picked up by the search.
e.g. <MadCap:keyword term="-option3" />
An index keyword might not be ideal for you, but you can set up a hidden text style in your style sheet and apply that to "-option3".

Both might be worth a try.
Regards,
Feebeegeebee
-----------------------------------------------------
Using Flare 2022 on Windows 11 (64-bit)
-----------------------------------------------------
ChoccieMuffin
Senior Propellus Maximus
Posts: 2632
Joined: Wed Apr 14, 2010 8:01 am
Location: Surrey, UK

Re: prevent line breaks at hyphens

Post by ChoccieMuffin »

Just bumping up my question from earlier - is there such a thing as a non-breaking underscore? I have a ton of items like VAR_M or THIS_THAT that I want to stick to a single line, but I can't figure out how to do it, or even if it's possible. I don't want to just chuck in a line break before the item because that's pants and means the topic looks rubbish on screen. I even tried wrapping the things in a div, but that just shoved the item on its own line, inside the paragraph. Yuck.

Any suggestions?
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
chrispitude
Propeller Head
Posts: 58
Joined: Thu Mar 23, 2017 12:23 pm

Re: prevent line breaks at hyphens

Post by chrispitude »

Feebeegeebee wrote:
If the user types "-option3" into a search dialog box in their media viewer (PDF, HTML5, etc.), there will be no match because a hyphen does not match a nonbreaking hyphen.
Just a couple of thoughts for this one that might be worth trying...

* If it's just a single word that includes the non-breaking hyphen, could you enter it as a synonym? If you can enter "-option3" with a normal hyphen and "-option3" with a non-breaking hyphen as synonyms, the search should pick it up when the user enters the term in the search field.

* Alternatively, if you go to the Text Editor, you could include the original term (with an ordinary hyphen) in the body of the page as hidden text. That way it is not visible to the user in the HTML output, but will get picked up by the search.
I have done this previously by entering a term as an index keyword on the page, which then gets picked up by the search.
e.g. <MadCap:keyword term="-option3" />
An index keyword might not be ideal for you, but you can set up a hidden text style in your style sheet and apply that to "-option3".

Both might be worth a try.
Regards,
Feebeegeebee
Thanks for the thoughts! This might fix search, but there is also the problem of people copying/pasting these examples into their command line - the nonbreaking hyphens cause syntax errors. At best, the character appears visually different and the user can figure it out. Or worse (and this has happened to me) - the character looks identical, and so you get syntax errors for seemingly no good reason.
ChoccieMuffin wrote:Just bumping up my question from earlier - is there such a thing as a non-breaking underscore? I have a ton of items like VAR_M or THIS_THAT that I want to stick to a single line, but I can't figure out how to do it, or even if it's possible. I don't want to just chuck in a line break before the item because that's pants and means the topic looks rubbish on screen. I even tried wrapping the things in a div, but that just shoved the item on its own line, inside the paragraph. Yuck.

Any suggestions?
Thanks for asking this. :) I've actually filed a support request for this generalized capability:

(Case 110327) MadCap Flare 2017 13.1.6219 Bug: cannot remove characters from line-breaking list

It asks for a setting that allows the user to specify the list of characters that permit line breaks. Fixing these issues would be as simple as removing the hyphen or underscore from the string. This is exactly how FrameMaker handles it (see attachment).
You do not have the required permissions to view the files attached to this post.
Post Reply