Excellent text editors (Markdown, LaTeX, and MathJax) in Linux)

Source: Internet
Author: User

Excellent text editors (Markdown, LaTeX, and MathJax) in Linux)

Such a title may not be accurate, because it is indeed unable to accurately explain what is "excellent text editor in Linux ". In fact, I want to talk about Markdown, LaTeX, and MathJax in this article. If you are interested, you can continue to read it and don't forget to give it a thumbs up.

Introduction

What tools do you use to write articles? Windows notepad? Certainly not! The average person should at least use a visual editor similar to the Word "What you see is what you get. Reason: because an article is not only a text, it also contains a variety of formats, such as font, font size, color, title, list, and so on. The "WYSIWYG" Editor provides the simplest editing method: to change the style of some text, you only need to select it, set the format in various menus and dialog boxes. This kind of text is beautiful and rich in style, which can be called "Rich Text ".

If you think more deeply, you will find that "Rich Text" has many shortcomings, especially for our programmers and tech experts. Here are some examples:

  • "Rich Text" is too slow to edit. When writing an article, you must consider the content of the article and the format of the Article. if you write a few words, you should take the mouse for half a day;
  • "Rich Text" requires a professional editor to edit and read. If there is no editor, or the editor is not compatible, it is just crying;
  • "Rich Text" often replaces logic with the form. In terms of appearance, the text size and indentation of titles at all levels are correct, but hierarchical relationships cannot be specified logically;
  • The format information in "Rich Text" is too redundant, and the content of the article is overwhelmed;
  • "Rich Text" is not friendly to computers, and the storage format is not transparent. It also makes text-line comparison tools (such as diff) useless.

Therefore, an excellent idea should be like this:

  • Articles should be stored in plain text format and can be read and edited using any tool;
  • The plain text content should be suitable for human reading and easy to understand by computers;
  • Correctly specify the logical structure of each part of the article;
  • Separated content and display, the author only needs to consider the content and logical structure of the article, and how the article looks good is a professional person and tool.

This is what I mentioned in the title as "cutting-based editing ideas ". This idea has been in the computer field for a long time and has gradually formed a philosophy. For example, HTML and XML, which are widely used on the Internet, are used to store information as plain text. They can be read and edited using any tool and correctly specify the logical structure of the content, the browser and CSS control how the document is displayed. However, there are still too many HTML tags. If there is no browser, it would be too difficult to completely rely on human brain to complete the reading. As a result, Markdown was born.

There is another difficulty in text editing, that is, mathematical formulas (or other similar mathematical formulas, such as music scores). They are displayed in two dimensions, in addition, many of the symbol standard keyboards cannot be entered, and the fonts and texts used are different. Fortunately, in the Unix/Linux world, there is a better solution, that is, LaTeX. Of course, there are also many visual editors that provide mathematical formula editing functions, such as Word-style editors, such as TexMacs. However, as mentioned above, LaTeX is the best way to think about the excellent "simplified editing idea", because LaTeX is used to input mathematical formulas in plain text mode, and the input speed is fast, both humans and computers are easy to understand. LaTeX is widely influenced. Many editors support inputting mathematical formulas using LaTeX syntax. To display a mathematical formula on a web page, it is not MathJax. It is a JavaScript library that can identify the mathematical formula in LaTeX format on the web page and display it perfectly. This is the mathematical formula supported by the blog.

Markdown features and tools

The purpose of Markdown is "easy to read and write". Therefore, it is very convenient to directly read documents written using Markdown syntax in plain text format. If you have high requirements on the appearance, you can use the corresponding tools to convert the Markdown document into HTML or PDF. The Markdown syntax is very simple. Generally, I learned it more than an hour later. Here is the Markdown syntax description (Simplified Chinese ).

Currently, the Markdown editor of the blog garden is basically used when I post a blog in the blog garden. The Markdown Implementation of the blog Park is not yet complete, for example, there is no real-time preview function, no behavior segment function`\`$\` `But it is quite comfortable to use. In addition to uploading images, there is basically no need to move the mouse.

Why is the function of continued behavior segments very important?

In other words, ignore line breaks after non-blank rows. This function is very important. Without this function, a piece of text is a long and long line, which is undoubtedly a fatal blow to automated tools based on text line comparison (such as diff. For the editor that can display the row number, the row number also jumps, making people look uncomfortable. But the most important thing is that users never know whether the line feed was added by themselves or automatically changed because the computer screen was not wide enough.

Therefore, both Markdown and LaTeX allow the author to wrap any line in the source code. As long as there are no blank lines in multiple lines of text, these lines are merged into a paragraph. To wrap a line in Markdown, you must add at least two spaces at the end of the previous line, and LaTeX allows you to use\\Manual line feed. So the question is, why does the blog Park remove such an important feature?

On a Linux desktop, I use ReText to edit the Markdown document. In Ubuntu, you only needsudo apt-get install retextYou can install the software as follows:

Configure ReText with pretty CSS

The newly installed ReText may not have as good a preview effect on the document as I did. It should be like this:

The distinction between the reference and the code and the body is not obvious, and the font display of the entire document is not good. This occurs because the corresponding CSS file is not specified for ReText. The only pity is that some ReText configurations cannot be completed through the menu. You must manually modify the configuration file.~/.config/ReText project/ReText.confMy configuration files are as follows:

As for where to find a beautiful CSS, the benevolent and wise will see wisdom. There are many good examples in the blog Park.

Enable mathematical formula support

The mathematical formulas displayed on the web page depend on MathJax. It is very easy to enable mathematical formulas in the blog Park. Just Tick the background management page. Because MathJax is used$To define mathematical formulas, so there are many articles or comments$Attention should be paid to the symbol. Think about it. It is used in my article.$Too many? Quite a bit. I used it when I introduced AT&T's Assembly syntax and used it when I discussed Bash Script Programming. So the layout of those two articles really cost me a lot. Besides$, MathJax is also used\(And\),$$And$$,\[And\]To define mathematical formulas.

Because MathJax is so famous and outstanding, ReText also has the corresponding MathJax extension, but the configuration file modified this time is~/.config/markdown-extensions.txt. My configuration files are as follows:

As you can see, line 1 of the configuration file is to enable the mathjax extension. For other extensions and functions, you can read the ReText help document.

Let's take a look at the mathematical formula in this article: Limit + ∞ 0 x n e −x dx = n!


Is the effect of using mathematical formulas in ReText:

Both results and efficiency are good! So far, my text work has been fully taken over by Markdown and MathJax. Mom no longer needs to worry about my Chinese homework and maths homework. As for the syntax of LaTeX to edit mathematical formulas, I would like to share with you another article: a relatively short LaTeX 2e introduction PDF. For download, see:

------------------------------------------ Split line ------------------------------------------

Free in http://linux.bkjia.com/

The username and password are both www.bkjia.com

The download directory contains excellent text editors (Markdown, LaTeX, and MathJax )/

For the download method, see

------------------------------------------ Split line ------------------------------------------

This article permanently updates the link address:

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.