<html><head><meta http-equiv="content-type" content="text/html; charset=utf-8"></head><body dir="auto"><div>Wouldn't it be better to use full LaTeX compatible syntax, like newcommand?<br><br>Aaron Meurer</div><div><br>
On Oct 3, 2013, at 12:13 AM, "David P. Sanders" <<a href="mailto:dpsanders@ciencias.unam.mx">dpsanders@ciencias.unam.mx</a>> wrote:<br><br></div><blockquote type="cite"><div><div dir="ltr">Hi:<div><br></div>
<div>The following is possibly relevant for tomorrow's meeting with the MathJax lead developer.</div><div><br></div><div>I have been playing with the idea of abbreviating LaTeX environments within Markdown. This is a direct result of live note-taking with the IPython Notebook in a course that I am co-teaching while the other professor gives a blackboard class with equations, and finding myself slowed down by writing verbose LaTeX.</div>



<div><br></div><div>(This is a common problem, which can be (partially) solved in other TeX editors by judicious use of macro completion.)</div>
<div><br></div><div>It seems to me that the full-blown LaTeX environments, in particular `\begin{equation}...\end{equation}, and particularly `align` [`equation` is easily replaced by $$...$$, since no equation numbering is yet available], are unnecessarily wordy for the IPython Notebook.</div>



<div><br></div><div>These full versions are necessary (?) when the relevant equation(s) are embedded in a full LaTeX document, but in the IPython Notebook, they are restricted to snippets of mathematics inside a Markdown cell. Thus, in the spirit of Markdown, we should (in my opinion) search for a more lightweight syntax for LaTeX snippets.</div>



<div><br></div><div>I have a branch `short_latex` at <a href="https://github.com/dpsanders/ipython/tree/short_latex" target="_blank">https://github.com/dpsanders/ipython/tree/short_latex</a></div><div>which allows the following syntax inside Markdown cells:</div>



<div><br></div><div># equation:</div><div>$eq y = 3x$</div><div><br></div><div># align:</div><div>$al </div><div>y &= 3x\\</div><div>z &= 4x</div><div>$</div><div><br></div><div>That is, it uses `$...$` as the delimiters for the environment, and fills out the environment based on the first word found after the first `$`. </div>


<div>The main benefit is to obviate the redundant \end{...} construction, and in general save typing. `$...$` is a natural way to separate LaTeX snippets from surrounding text (and, in particular, one which is already supported by the current code).</div>



<div><br></div><div>The implementation currently intercepts the blocks of mathematics after they are found (in the text-cell rendering function in `textcell.js`), checks if they are of this form, and if so, replaces them by the full LaTeX environment so that they are correctly rendered by MathJax. </div>


<div>[Health warning: my JavaScript is still rather shaky...]</div>
<div><br></div><div>The `cases` environment is also supported, but currently has the limitation that it must come at the start of a LaTeX snippet:</div><div><br></div><div>$y = $ $ca 1 & \text{if } x>0\\</div><div>


0 & \text{if } x \le 0 </div><div>$</div><div><br></div><div>This could be fixed e.g. using</div><div>$y = ca{...}$  </div><div>or some similar notation.</div><div><br></div><div>Maybe a better solution would be to simply treat these as some kind of macro that would expand directly in the text stored in the text cell itself, so that it would be correctly rendered even in a version of IPython without this modification. (Though I am not sure how to go about doing this.)</div>



<div><br></div><div>Is this something that people are interested in pursuing?</div><div>(Or does it just look too artificial and weird?) If so, might it be possible to do something at the level of MathJax itself?</div><div>


<br></div><div>Best wishes,</div><div>David.</div><div><br clear="all">
<div><br></div>-- <br><div dir="ltr">
Dr. David P. Sanders<br><br>Profesor Titular "A" / Associate Professor<br>Departamento de Física, Facultad de Ciencias<br>Universidad Nacional Autónoma de México (UNAM)<br><br><a href="mailto:dpsanders@ciencias.unam.mx" target="_blank">dpsanders@ciencias.unam.mx</a><br>




<a href="http://sistemas.fciencias.unam.mx/%7Edsanders" target="_blank">http://sistemas.fciencias.unam.mx/~dsanders</a><br><br>Cubículo / office: #414, 4o. piso del Depto. de Física                           <br>Tel.: +52 55 5622 4965<br>




</div>
</div></div>
</div></blockquote><blockquote type="cite"><div><span>_______________________________________________</span><br><span>IPython-dev mailing list</span><br><span><a href="mailto:IPython-dev@scipy.org">IPython-dev@scipy.org</a></span><br>
<span><a href="http://mail.scipy.org/mailman/listinfo/ipython-dev">http://mail.scipy.org/mailman/listinfo/ipython-dev</a></span><br></div></blockquote></body></html>