I find quite often I want to write few mathematical expressions, but diving into LaTeX might sound a bit overwhelming. As we say in Spanish, it’s like hunting flies with cannons

I describe below an open source solution which I believe will be really helpful for you.

Installation

You will need to

  1. Install the latest atom version from official website.
  2. Open atom and go to Settings (Ctrl + ,) > Install
  3. Install markdown-preview-enhanced package.
  4. Disable markdown-preview package. This package is installed by default after installing atom.

How to use it

Render in real time

The point of using this package is the possibility to render in real time TeX expressions together with markdown. To do so:

  1. Go to Settings (Ctrl + ,) > Packages
  2. Look for markdown-preview-enhanced package.
  3. Click the button Settings.
  4. Scroll down and check the box Live Update.

Writing

We are ready to write, we need to enable the Preview pane. Otherwise, you will just see your markdown code, instead of the render.

You can do this in three different ways:

  • Shortcut: hit Ctrl + Shift + M.
  • Command palette:
    1. Hit Ctrl + Shift + P to open the Command Palette.
    2. Type Markdown Preview Enhanced: Toggle and hit ENTER.
  • Right click menu: right click over the text of a markdown file and select the option Toggle markdown-preview-enhanced.

Examples

Inline

Code:

This is an inline latex formula. $\frac[x^2][b]$ Do you like it?

Output:

2017-04-14 12_06_49-markdown-latex.pdf - SumatraPDF

Block

Code:

This is an block latex formula, see below:
$
a_0+\cfrac{1}{a_1+\cfrac{1}{a_2+\cfrac{1}{a_3+\cdots}}}
$
Do you like it?

Output:

2017-04-14 12_07_09-markdown-latex.pdf - SumatraPDF

More stuff

Math Rendering Option

This option can be found in the package settings.

Change the Math Rendering Option to MathJax.

The package sets KaTeX by default. However, I found this package didn’t support \cfrac (and it sucks to use \frac for big fractions as they look pretty poor… ¬¬).

Exporting to PDF

To export your document to a PDF:

  1. Right click on the preview pane.
  2. Select Export to Disk.
  3. Select PDF
  4. Choose your settings and hit Export.

References

You can check the official repository of this package in GitHub for further information. There are much more things this package can do apart from rendering LaTeX.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s