2
$\begingroup$

I want to create an input cell with two lines, like the following:

a="aaaaaaa";
b="bbbbbb"; c="ccccc";

That is as I want to have it. Now insert in the first string some more characters a. When the length of the string is about 60 (slightly over halfway the notebook line), the assignment to c moves to the next line. The only way I can put it back to the second line is to use a carriage return after the assignment to c, resulting in an empty third line, which I do not want to see either.

My feeling is that this annoying behaviour is due to some notebook settings, but I have no idea which ones. How do I keep the assignments to b and c on one line, without creating an empty third line?

$\endgroup$
  • 1
    $\begingroup$ You can type \[NoBreak] before c but I guess you want something more robust and user friendly. Maybe there is an option that governs this but I don't remember any. I use Code cells if I want to control indentation etc. $\endgroup$ – Kuba Sep 24 '18 at 13:13
  • 3
    $\begingroup$ It might actually be a bug. I ran into this many times and always found it very annoying. $\endgroup$ – Szabolcs Sep 24 '18 at 13:18
  • $\begingroup$ @Kuba. That works, thanks! I did not know that such a symbol exists. But it only corrects something that should not happen. $\endgroup$ – Fred Simons Sep 24 '18 at 18:11
2
$\begingroup$

Start with input cell containing

a="aaaaaaa";
b="bbbbbb"; c="ccccc";

From the Format menu select Word Wrapping / Don't word wrap. Then insert more 'a', it does not wrap.

$\endgroup$
  • $\begingroup$ Thanks for looking at this problem. Your solution works nicely, but only when the length of the first line is less than the window width. If it is longer (say a compound expression with many short arguments), then I think it is not a good idea to switch off automatic line breaking. $\endgroup$ – Fred Simons Sep 24 '18 at 18:10

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.