Use Markdown+pandoc+latex+beamer to make slides

Source: Internet
Author: User
Tags readable set background word wrap

This article is reproduced to: http://www.mamicode.com/info-detail-226624.html

Overview why use Markdown.

Mardown is a lightweight markup language that is simple, readable, and easily translated into other formats, and is increasingly used in technical document writing. I believe you have a certain understanding of markdown, if you do not understand the Internet has a lot of results, grammar can refer to the markdown Grammar description (Simplified Chinese version). The author now writes the document and the PPT gradually shifts from office to the markdown, its benefit is

Plain text for easy editing you can manage portability with version management tools.

Content and format separation when writing can be focused on the content of the change format, a change, everywhere effective

This article briefly describes the process of making slides with markdown. basic processes and tools

Mardown the process of making slides is usually to write a text file with Markdown, and then use the tool to convert to HTML or PDF format. This process, if necessary, can be modified with CSS or Tex templates. The tools used are: Any text editor: Used to edit the markdown source file Pandoc: A tool that converts markdown to other formats (the main introduction to PDF) Latex:pandoc convert markdown to PDF, the Latex engine is needed. If you want to support Chinese, you can install Xelatex Beamer:latex to make slides under the toolkit

Of course, you can make slides directly with Latex+beamer, but you need to write the Tex source file, which is more cumbersome and less readable than markdown. So I use Markdown to write the content, the way Tex does the template. a basic slide edit Markdown Source Files

Pandoc treats the first level of markdown as a slide group, treats the level two title as a slide title, and the content under level two headings on a slide. However, if there is no level two heading under a heading, then Pandoc will treat the first level title as a slide title, placing the content under this level heading on a slide and the level two title as a child box.

At any time, using '---------' can produce a new slide.

Pandoc has an extension to markdown, preceded by a three line of content that starts with a%, title, author, and date respectively.

Examples are as follows

% Title
% auther
% Date # This is the group # # This is Title 1 This is the is

  --Item 1
  --it EM 2

# # is tile 2 This is

  second slide-------------The This is

  third slide
Convert to PDF

Save the above code as EXAM1.MD and run

Pandoc-t Beamer-o exam1.pdf exam1.md

You can generate PDFs. the extension of Pandoc to Markdown

Pandoc the markdown syntax that supports the standard, and also makes some useful extensions, the title, author, and date above. In addition, there are more practical forms, formulas and so on. See Pandoc's documentation for details. Table

Pandoc supports forms identified with text, such as

A b  c
------
 a b  c

Or

| A | B | C |
| ---|---|---|
| A | B | C |
Formula

Pandoc supports the formula syntax for Latex, where you can insert inline formulas between $ ... $. If you want to make a single row for a formula, use two $, that is, $$ ... $$. Chinese Support

To display Chinese correctly, you need to be aware of two points: use the Xelatex engine to properly configure in the template file

First export the Pandoc beamer default configuration

Pandoc-d Beamer > Beamer-template.tex

Add support for Chinese after \ifxetex

\USEPACKAGE{XECJK}                 % set
\setcjkmainfont{wenquanyi Micro Hei}% Chinese font
\setmainfont{arial}                % English font
\setromanfont{courier New}
\setmonofont{courier new}
\linespread{1.2}\selectfont        % leading
\ Xetexlinebreaklocale "en"         % Chinese
word wrap \xetexlinebreakskip = 0pt plus 1pt% between 0pt to 1pt
\parindent 0em                     % Segment indent
\setlength{\parskip}{20pt}         % segment spacing

Using commands at compile time

Pandoc-t Beamer--latex-engine=xelatex--template=beamer-template.tex xx.md-o xx.pdf
Practical Tips Set Page proportions

Add the parameter aspectratio=169 to the documentclass of the template file, i.e.

\documentclass[., aspectratio=169]{$documentclass $}

You can set the page scale to 16:9 (default is 4:3). Set background picture

In my work, I need to use the company's ppt template, so I need to set the background of the slide. The ultimate solution is this:

Add a command to a template file

\usebackgroundtemplate{\includegraphics[width=\paperwidth, Height=\paperheight]{background.png}}

If you want to set a separate background for the title page, the author uses the method in this article:

\requirepackage{tikz}
\addtobeamertemplate{title page}{%
    \begin{tikzpicture}[remember Picture,overlay]
        \node [xshift=0cm,yshift=0cm] at (current page.center)
            {\includegraphics[width=\paperwidth, height=\paperheight]{background_title.png}};
    \end{tikzpicture}%
{}
Conclusions

With these, you can basically use Markdown to complete the task of making slides.

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.