Take the 2-minute tour ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

Continuing the theme of minor interface annoyances, one of the unique features of Mathematica as a text editor is the automatic adjustment of text location as you type. This could be a bit disorienting...Any way to make it stop?

share|improve this question
add comment

2 Answers 2

up vote 4 down vote accepted

I interpret this question differently: you want an Input cell that does not reflow text such than manual line breaks and indentation are preserved.

This is the behavior of the built-in Code cell style, but that by default comes with baggage such as making the cell an Initialization Cell and a gray background. It also turns off all auto-spacing, meaning that an expression like a = 2 + 2 is rendered as a=2+2 unless you manually space it out. An alternative is to create your own cell style or modify the Input style using custom Style Sheets.

As an example open a new Notebook, then Format > Edit Stylesheet... and paste this at the bottom of the file:

Cell[StyleData["ManualInput", StyleDefinitions -> StyleData["Input"]],
 PageWidth -> Infinity,
 CellHorizontalScrolling -> True,
 PageBreakWithin -> False,
 GroupPageBreakWithin -> False,
 LineBreakWithin -> False,
 AutoIndent -> False,
 MenuPosition -> 1540
]

If asked to "Interpret text" click Yes.

Now close the Style Sheet and create a new Cell with Style ManualInput using the Format > Style menu. This gives you a cell you can paste code into without it reflowing, or manually indent your code. If you want to use this style in place of the default Input you could use the code above but replace StyleData["ManualInput", StyleDefinitions -> StyleData["Input"]] with StyleData["Input"]. If you want to always use this style you can save this Style Sheet and then point Mathematica to it as the default:

Mathematica graphics

share|improve this answer
    
Sorry for being a bit vague, but you did interpret my question correctly. I find it disorienting to have to keep looking for the code I am writing while I am writing it. This solves the issue, thanks! –  Moshe Oct 14 '12 at 19:17
add comment

If you mean InputAutoReplacements in text cells you can switch these off in the options inspector.

enter image description here

But this means doing it every time you want to switch it off best to add it to your stylesheet programmatically:

SetOptions[EvaluationNotebook[], 
 StyleDefinitions -> 
  Notebook[{Cell[StyleData[StyleDefinitions -> "Default.nb"]], 
    Cell[StyleData["Text"], InputAutoReplacements -> {}]}, 
   StyleDefinitions -> "PrivateStylesheetFormatting.nb"]]

Or evaluating this:

CreateDocument[
 Notebook[{Cell[StyleData[StyleDefinitions -> "Default.nb"]], 
   Cell[StyleData["Text"], InputAutoReplacements -> {}]}, 
  StyleDefinitions -> "PrivateStylesheetFormatting.nb"]]

... and installing this change as a new stylesheet. If that is not what you mean by "automatic adjustment of text location" can you explain/clarify/expand?

share|improve this answer
    
I think this refers to what I had in mind. How do I switch it off in input cells? –  Moshe Oct 13 '12 at 22:17
    
replace StyleData["Text"] with StyleData["Input"] –  Mike Honeychurch Oct 13 '12 at 22:22
    
Excellent, I will try that, thanks! –  Moshe Oct 13 '12 at 22:23
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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