# keep text together?

In Writer I want to write, say -58 (negative number). Unfortunately the number is located near the right margin, so the minus is left alone in line a, while line a+1 starts with 58.

How do I keep -58 together?

Sorry, forgot to mention, I am using Version: 6.1.5.2 (x64) I solved it by changing my text slightly, but...

edit retag close merge delete

By convention this should not happen because the minus sign (or plus sign) should be considered as part of the number. I am using LO v6.1.5.2 and the same thing happens here. One work-around might be to add an extra space in front of the minus sign, in order to force it on to the next line with the rest of the number. But if you edit that first line in any way, you will have to remember to check what happens to the number.

I think this should be reported as a bug at https://bugs.documentfoundation.org/

( 2019-04-28 00:52:34 +0200 )edit

Sort by » oldest newest most voted

A general way to prevent a linebreak in a specific place is to insert the unicode WORD JOINER U+2060 there.
In recent LibO: Type 2060 and hit Alt+X then.

more

This does not work for me. ALT-X opens the menu Extras. Here it is ALT-C while ALT-X is maybe intended for use in dialogs?

( 2019-04-28 18:09:27 +0200 )edit

Typographically speaking, a dash cannot be considered a "minus sign" ;) There is a dedicated minus sign in Unicode (U+2212) that will go to the following line with the number. You can insert it in Writer by typing

:-:

(colon, normal dash, colon). As soon as you insert the second colon, the minus sign is introduced.

more

:-: does not work here. But could reproduce (U+2212) as designated Unicode "minus" whilst it looks like a dash related to the length. OP is using a hyphen / minus which is IMHO typographically the correct symbol for an algebraic sign. Difference in length is dash − and hyphen - and the typographical (again IMHO) function of a dash is not to be used as algebraic sign although it is linked to the number. Edit: You are right, U+2212 − is the typographically correkt "minus" but cause of the common use of - it looks so familar. I saw these long − mostly in LaTeX or formula generators aso.

( 2019-04-28 19:10:47 +0200 )edit

Hello, no this is not a bug IMHO. The hyphen is the designated delimiter. To prohibit LO Writer from seperating the hyphen from the number you could insert a non-breaking hyphen instead of a "minus". Use CTRL-SHIFT-'minus' ("-"). The result will be a hyphen in a somehow gray box.

To show the community your question has been answered, click the check mark (✓) next to the correct answer. Also you could 'upvote' by clicking on the up arrow (^) for any helpful answers. This is the mechanisms for communicating the quality of the Q&A on this site. Thanks!

more

OK, so the minus sign is properly positioned but why would would gray box background be acceptable? Still seems a problem.

( 2019-04-28 05:35:21 +0200 )edit

The gray background is only a reminder that the character has some special property. It shows on screen only and does not print.

( 2019-04-28 07:59:00 +0200 )edit

Right, only to signal that this is a protected hyphen. I found two other methods in the documentation. First, you could put the word into the dictionary and exclude it from being separated (did not try since this is only reasonable for more then one time used words) and second there seems to be a way for individual exclusion with menu (don't know for the english version) Format - Zeichen - Schriftart >> "keine". But that did not work for me, which is probably a bug.

( 2019-04-28 08:55:50 +0200 )edit

For me it's LO 6.2.2.2 on Windows 10.

( 2019-04-28 08:56:46 +0200 )edit

The hyphen is the designated delimiter

@Cookievore : I am not a purist but this must be a mistake. It is not a hyphen, it is a minus sign. The sign of a number (plus or minus) is a part of the number, just like the decimal point (or comma), and should not be separated from the number in normal text. So any "hyphen" directly in front of a number should be considered as a minus sign and part of the number. I think the OP would be justified in reporting this as a bug.

( 2019-04-28 16:21:05 +0200 )edit

@ve3oat : interesting point of view. I agree with you in question of 'part of the number' but actually the minus is used to function as hyphen and as minus since there is no other key on the keyboard. Maybe Writer should be improved in its behaviour but other wordprocessors act the same way and are taking a "-" (minus) as indicator to break the line at this point if necessary. Also the given example runs the same way e.g. in Word. Maybe a Dev could give us a reason why using it as break indicator has a higher priority then interpreting it as algebraic sign that should be linked to the number. Also the existence of CTRL-SHIFT-'minus' method indicates to me, that this is intended behaviour and implemented to cover such scenarios.

( 2019-04-28 18:05:04 +0200 )edit

The ambiguity between hyphen and algebraic sign is as old as computers. Even Unicode does not set new rules for this as it would break virtually every document written up-to-date. In my knowledge, only programming language APL introduced a distinction between sign (an intrinsic property of a number) coded as 0x40 in ISO IR-68 and the negation/subtraction operator coded as 0x5F in ISO IR-68 (equivalent to U+002D HYPHEN-MINUS).

Strangely enough, I haven't found the APL minus sign in the APL Unicode block. The closest approximation would be macron U+00AF, but once again this causes an ambiguity between the linguistic use of macron and the sign of a number.

Consequently we must live with this ambiguity. If we want to be immune against spurious line wrapping, we can use U+2212 MINUS SIGN as suggested by @RGB-es since this is the intended semantics or add a ZERO ...(more)

( 2019-04-28 19:40:32 +0200 )edit

@Cookievore : Thanks for your comments and it seems you are probably right about the CTRL-SHIFT-'minus' method being the intended solution for this problem. And certainly most keyboards do not allow one to distinguish between the function of a minus sign and a hyphen. WordPerfect behaves the same as LO, though in many years of preparing documents (and more recently in LO), I can not recall ever encountering the problem before. Despite my own experience, this must not be a rare problem and I am glad the OP has raised it. I will upvote his question.

( 2019-04-28 19:59:01 +0200 )edit

@ajlittoz : Very interesting. I could be wrong but I recall that in FORTRAN the "-" sign was always treated as a minus sign unless it was part of the name of a variable, although on second thought it might not have been allowed there. Indeed, the situation is not user-friendly.

( 2019-04-28 20:12:13 +0200 )edit

@ve3oat: in FORTRAN (at least up to F77) a dash sign is either a negative sign or the subtraction operator. At that time, names (variables, function and subprograms) where limited to 6 characters from A-Z0-9, a constraint inherited from the IBM mainframes of the '50s. Remember FORTRAN had a strange (for contemporary idiosyncrasies) rule of ignoring spaces outside strings or Hollerith constant, putting a serious stress on compilers to determine the extension of identifiers or even recognise statements (e.g.: what is DO10I? Is it a REAL variable or the beginning of a DO statement?

Nostalgy …

( 2019-04-28 21:11:40 +0200 )edit