# Pressing the "enter" key in the Python External Evaluation cell becomes "run" instead of "line break"

I have met problem in the use of style sheet. In using the External Evaluation of Python in Mathematica, If we choose the style sheet as "Default", pressing the "Enter" will cause a line break in the cell. However, When I changed the style sheet into "Journal Article", Pressing the "Enter" will run the python program. To let it more clear, I list the screenshot [![enter image description here][1]][1]

I also noticed that the Equation numbered in Journal articel will create new cell rather than a line break too. Any one knows how to change the behavior of pressing Enter?

The “Enter” is the "Left Enter"， not the "Right Enter" in number area. My mathematica is 12.0 and in Windows 10. [1]: https://i.stack.imgur.com/1Dxy0.png

• Regarding the python external evaluation cell concerns: What kind of system are you using, and which enter are you pressing? Left/right? Note that these keys represent different operations in different systems. Aug 22 '20 at 8:04
• Sorry for the uncomplete information, I have added the missed information in my question Aug 22 '20 at 8:34

Pressing the “enter” key in the Python External Evaluation cell becomes “run” instead of “line break”

I think the python code cell is not evaluated. The "Enter" key merely creates a new cell rather than inserts a new line. (If you have confirmed that the statement above isn't true, please edit the question.)

This is due to an option ReturnCreatesNewCell -> True specified for StyleData["Notebook"] in the stylesheet JournalArtical.nb.

You can evaluate one of these to disable such an option:

SetOptions[EvaluationNotebook[], FrontEndReturnCreatesNewCell -> False]

SetOptions[EvaluationNotebook[],
StyleDefinitions -> Notebook@{
Cell@StyleData[StyleDefinitions -> FrontEndFileName[{"Article"}, "JournalArticle.nb", CharacterEncoding -> "UTF-8"]],
Cell[StyleData@"ExternalLanguage", FrontEndReturnCreatesNewCell -> False]
}
]

SetOptions[EvaluationNotebook[],
StyleDefinitions -> Notebook@{
Cell@StyleData[StyleDefinitions -> FrontEndFileName[{"Article"}, "JournalArticle.nb", CharacterEncoding -> "UTF-8"]],
Cell[StyleData@"Notebook", FrontEndReturnCreatesNewCell -> False]
}
]
$$$$

• Thank you so much, I test your first command and it solves my probelm! Aug 22 '20 at 8:36