I would recommend you go with the default CK editor but with some custom addons which you can easily get after some modification.
FOR CODE
Take a look at this: https://ckeditor.com/docs/ckeditor4/latest/examples/codesnippet.html.
In there, you'll find a reference to https://ckeditor.com/cke4/addon/codesnippet. That's a CKEditor plugin. Try installing it following the steps in here: https://www.question2answer.org/qa/66264
This is the most up-to-date approach to follow.
MATHJAX
You can directly use the script in the head via the Layouts section and then use the code of mathjax under the editor.
Still doubts? Comment.
Welcome to the Q&A site for Question2Answer.
If you have a question about Q2A, please ask here, in English.
To report a bug, please create a new issue on Github or ask a question here with the bug tag.
If you just want to try Q2A, please use the demo site.