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$
3
  • 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
    Commented Sep 24, 2018 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
    Commented Sep 24, 2018 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$ Commented Sep 24, 2018 at 18:11

1 Answer 1

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$
1
  • $\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$ Commented Sep 24, 2018 at 18:10

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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