Young老师的教学主页
  • Home
  • Categories
  • Tags
  • Archives

Code test

测试各种代码的markdown支持能力。

C/C++

#include <iostream>
using namespace std;
int main(int argc, char** argv)
{
  cout << "Hello, world!" << endl;
  return 0;
}

Java

public class Hello
{
  public static voi main(String argv[])
  {
    System.out.println("Hello, world.\n");
  }
}

PHP

print "Hello, world!\n"

Latex

\documentclass[12pt,a4paper]{article}
\usepackage{fontspec}
\usepackage{indentfirst}
%\usepackage{xeCJK}
\XeTeXlinebreaklocale "zh"
\XeTeXlinebreakskip = 0pt plus 1pt

%\setromanfont{STCaiyun}
\setromanfont{Microsoft YaHei}

\begin{document}
\section{咏鹅}
鹅,鹅,鹅,
曲项向天歌,
白毛浮绿水,
红掌拨清波。
\end{document}

CodeHilite extension 风格示例

There are two ways to specify the identifier: 也就是用单独一行:::python开头

print("The triple-colon syntax will *not* show line numbers.")

To display line numbers, use a path-less shebang instead of colons: 也就是用单独一行#!python开头

1
print("The path-less shebang syntax *will* show line numbers.")

Java示例

1
2
3
4
5
6
7
public class Hello
{
  public static voi main(String argv[])
  {
    System.out.println("Hello, world.\n");
  }
}

cpp示例

#include <iostream>
using namespace std;
int main(int argc, char** argv)
{
  cout << "Hello, world!" << endl;
  return 0;
}

Latex 示例

\documentclass[12pt,a4paper]{article}
\usepackage{fontspec}
\usepackage{indentfirst}
%\usepackage{xeCJK}
\XeTeXlinebreaklocale "zh"
\XeTeXlinebreakskip = 0pt plus 1pt

%\setromanfont{STCaiyun}
\setromanfont{Microsoft YaHei}

\begin{document}
\section{咏鹅}
鹅,鹅,鹅,
曲项向天歌,
白毛浮绿水,
红掌拨清波。
\end{document}
Comments
comments powered by Disqus

Published

1 3, 2016

Category

教学

Tags

  • code 1
  • markdown 3
  • pelican 3

Contact

  • Powered by Pelican. Theme: Elegant by Talha Mansoor