代码

请使用XeLatex编译

main.tex

  1. \documentclass{article}
  2. \usepackage{ctex}
  3. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  4. % 页面设置
  5. \usepackage{geometry}
  6. \geometry{a4paper,scale=0.8}
  7. %\usepackage{fontspec}
  8. %\setmonofont{Consolas}
  9. \usepackage{chngpage}
  10. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  11. % 表格
  12. \usepackage{diagbox}
  13. % 超链接
  14. \usepackage{hyperref}
  15. \hypersetup{hidelinks}
  16. % 图片
  17. \usepackage{graphicx}
  18. \usepackage{subfigure} % \subfigure[]{}
  19. \usepackage{caption} % \caption*{}
  20. % 浮动
  21. \usepackage{float} % [H]
  22. % 列表
  23. \usepackage{enumerate}
  24. % pandoc markdownlatex
  25. \newcommand{\tightlist}{\setlength{\itemsep}{0pt}\setlength{\parskip}{0pt}}
  26. \usepackage{longtable}
  27. \usepackage{booktabs}% \toprule, \midrule, \bottomrule
  28. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  29. % 数学
  30. \usepackage{mathrsfs} % \mathscr
  31. \usepackage{amssymb,amsfonts,amsmath,amsthm,mathtools}
  32. \usepackage{xcolor}
  33. \usepackage{mdframed}
  34. \mdfdefinestyle{shadeStyle}{backgroundcolor=gray!10,linewidth=0pt,innerleftmargin=1ex,innertopmargin=-0.5ex}
  35. \theoremstyle{plain}
  36. \newmdtheoremenv[style=shadeStyle]{theorem}{定理}[section]
  37. \newmdtheoremenv[style=shadeStyle]{lemma}[theorem]{引理}
  38. \newmdtheoremenv[style=shadeStyle]{proposition}[theorem]{命题}
  39. \newmdtheoremenv[style=shadeStyle]{corollary}[theorem]{推论}
  40. \theoremstyle{definition}
  41. \newtheorem{definition}[theorem]{定义}
  42. \newtheorem{exercise}[theorem]{习题}
  43. \newtheorem{question}[theorem]{问题}
  44. \newtheorem{example}[theorem]{例}
  45. \theoremstyle{remark}
  46. \newtheorem{remark}[theorem]{注}
  47. \newtheorem{notation}[theorem]{记号}
  48. \newtheorem{summary}[theorem]{总结}
  49. \swapnumbers
  50. \newcommand{\nameOfIt}{}
  51. % customized theorem
  52. \theoremstyle{plain}
  53. \newmdtheoremenv[style=shadeStyle]{custhm}[theorem]{\nameOfIt}
  54. \newenvironment{mytheorem}[1]{\renewcommand{\nameOfIt}{#1}\begin{custhm}}{\end{custhm}}
  55. % customized definition
  56. \theoremstyle{definition}
  57. \newtheorem{cusdef}[theorem]{\nameOfIt}
  58. \newenvironment{mydefinition}[1]{\renewcommand{\nameOfIt}{#1}\begin{cusdef}}{\end{cusdef}}
  59. % customized remark
  60. \theoremstyle{remark}
  61. \newtheorem{cusrmk}[theorem]{\nameOfIt}
  62. \newenvironment{myremark}[1]{\renewcommand{\nameOfIt}{#1}\begin{cusrmk}}{\end{cusrmk}}
  63. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  64. % 代码
  65. \usepackage{listings}
  66. %\usepackage{xcolor}
  67. \lstset{
  68. %language=Octave,
  69. numbers=left,
  70. numberstyle=\small,
  71. stepnumber=1, % the step between two line-numbers. If it's 1, each line will be numbered
  72. numbersep=5pt, % how far the line-numbers are from the code
  73. backgroundcolor=\color{white}, % You must add \usepackage{color}
  74. showspaces=false, % show spaces adding particular underscores
  75. showstringspaces=false, % underline spaces within strings
  76. showtabs=false, % show tabs within strings adding particular underscores
  77. frame=shadowbox, % single / shadowbox
  78. %rulecolor=\color{black}, % if not set, the frame-color may be changed on line-breaks within not-black text (e.g. commens (green here))
  79. rulesepcolor=\color{red!20!green!20!blue!20},
  80. tabsize=2, % sets default tabsize to 2 spaces
  81. captionpos=b, % sets the caption-position to bottom
  82. breaklines=true, % sets automatic line breaking
  83. breakatwhitespace=false, % sets if automatic breaks should only happen at whitespace
  84. title=\lstname, % show the filename of files included with \lstinputlisting; also try caption instead of title
  85. basicstyle=\ttfamily,
  86. %keywordstyle=\color{red},
  87. commentstyle=\color{grey},
  88. %stringstyle=\color{mauve},
  89. escapeinside={\%*}{*)}, % if you want to add LaTeX within your code
  90. morekeywords={*,...} % if you want to add more keywords to the set
  91. }
  92. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  93. % 算法/伪代码
  94. \usepackage{algorithm}
  95. \usepackage{algorithmicx}
  96. \usepackage{algpseudocode}
  97. \floatname{algorithm}{算法}
  98. \renewcommand{\algorithmicrequire}{\textbf{输入:}}
  99. \renewcommand{\algorithmicensure}{\textbf{输出:}}
  100. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  101. %TikZ
  102. \usepackage{tikz}
  103. \usepackage{mathdots}
  104. \usepackage{yhmath}
  105. \usepackage{cancel}
  106. \usepackage{color}
  107. \usepackage{siunitx}
  108. \usepackage{array}
  109. \usepackage{multirow}
  110. %\usepackage{gensymb}
  111. \usepackage{tabularx}
  112. \usetikzlibrary{fadings}
  113. \usetikzlibrary{patterns}
  114. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  115. \title{中文article模板}
  116. \author{maoruimas}
  117. %\date{}
  118. \setlength{\parindent}{0pt} % 首行不缩进
  119. \begin{document}
  120. \maketitle
  121. % 正文
  122. \input{body}
  123. \end{document}

body.tex

  1. 请使用XeLaTeX编译. 推荐\url{https://www.overleaf.com/}.
  2. \section{表格}
  3. \begin{table}[H]
  4. \centering
  5. \begin{tabular}{c|ccccccc}
  6. \diagbox[height=2em]{$p$}{$k$} & 0 & 1 & 2 & 3 & 4 \\
  7. \hline
  8. 0 & 1 & 0 & 0 & 0 & 0 \\
  9. 1 & 0 & 1 & 0 & 0 & 0 \\
  10. 2 & 0 & 1 & 1 & 0 & 0 \\
  11. 3 & 0 & 2 & 3 & 1 & 0 \\
  12. 4 & 0 & 6 & 11 & 6 & 1 \\
  13. \end{tabular}
  14. \caption*{斯特林数$s(p,k)$}
  15. \end{table}
  16. \section{多图并列}
  17. \begin{figure}[H]
  18. \centering
  19. \subfigure{
  20. \begin{minipage}[t]{0.3\linewidth}
  21. \centering
  22. \includegraphics[width=\linewidth]{y-x.png}
  23. \caption*{$y=\dfrac {\kappa \left( 0\right) }{2}x^{2}$}
  24. \end{minipage}
  25. }
  26. \subfigure{
  27. \begin{minipage}[t]{0.3\linewidth}
  28. \centering
  29. \includegraphics[width=\linewidth]{z-x.png}
  30. \caption*{$z=\dfrac {\kappa \left( 0\right) \tau \left( 0\right) }{6}x^{3}$}
  31. \end{minipage}
  32. }
  33. \subfigure{
  34. \begin{minipage}[t]{0.3\linewidth}
  35. \centering
  36. \includegraphics[width=\linewidth]{z-y.png}
  37. \caption*{$z^{2}=\dfrac {2}{9}\dfrac {\tau ^{2}\left( 0\right) }{\kappa \left( 0\right) }y^{3}$}
  38. \end{minipage}
  39. }
  40. \end{figure}
  41. \section{数学}
  42. \begin{definition}
  43. $\mathbb{I}_{K}$是整体域$K$Idele群, 定义$K$\textbf{1-Idele群}为$\mathbb{I}^{1}_{K} = \{x\in \mathbb{I}_{K}||x|=1\}$.
  44. \end{definition}
  45. \begin{theorem}\label{ik}
  46. $K^{\times }$$\mathbb{I}^{1}_{K}$中离散, $\mathbb{I}^{1}_{K} /K^{\times }$紧.
  47. \end{theorem}
  48. \begin{remark}
  49. $\mathbb{I}_{K} /K^{\times }$不一定紧.
  50. \end{remark}
  51. \begin{mytheorem}{良序基本定理}[自定义定理格式]
  52. 任意良序集与某个序数同构.
  53. \end{mytheorem}
  54. \begin{proof}[定理\ref{ik}的证明]
  55. blabla.
  56. \end{proof}
  57. \section{代码}
  58. \begin{lstlisting}[language={C++}]
  59. int powmod(int a, int b, int m) {
  60. int res = 1;
  61. while (b > 0) {
  62. if (b & 1) {
  63. res = (res * a) % m;
  64. }
  65. a = (a * a) % m;
  66. b >>= 1;
  67. }
  68. return res;
  69. }
  70. \end{lstlisting}
  71. \section{算法}
  72. \begin{algorithm}
  73. \caption{示例}
  74. \begin{algorithmic}[1] %行号
  75. \Function {MergerSort}{$Array, left, right$}
  76. \State $result \gets 0$
  77. \If {$left < right$}
  78. \State $middle \gets (left + right) / 2$
  79. \State $result \gets result +$ \Call{MergerSort}{$Array, left, middle$}
  80. \State $result \gets result +$ \Call{MergerSort}{$Array, middle, right$}
  81. \State $result \gets result +$ \Call{Merger}{$Array,left,middle,right$}
  82. \EndIf
  83. \State \Return{$result$}
  84. \EndFunction
  85. \end{algorithmic}
  86. \end{algorithm}
  87. \section{TikZ}
  88. 推荐使用\url{https://www.mathcha.io}绘图.
  89. \tikzset{every picture/.style={line width=0.75pt}} %set default line width to 0.75pt
  90. \begin{center}
  91. \begin{tikzpicture}[x=0.75pt,y=0.75pt,yscale=-1,xscale=1]
  92. \draw [draw opacity=0][dash pattern={on 4.5pt off 4.5pt}] (250,159.56) .. controls (250,159.52) and (250,159.49) .. (250,159.46) .. controls (250,148.71) and (292.53,140) .. (345,140) .. controls (397.47,140) and (440,148.71) .. (440,159.46) .. controls (440,159.5) and (440,159.53) .. (440,159.57) -- (345,159.46) -- cycle ; \draw [color={rgb, 255:red, 0; green, 0; blue, 0 } ,draw opacity=1 ][dash pattern={on 4.5pt off 4.5pt}] (250,159.56) .. controls (250,159.52) and (250,159.49) .. (250,159.46) .. controls (250,148.71) and (292.53,140) .. (345,140) .. controls (397.47,140) and (440,148.71) .. (440,159.46) .. controls (440,159.5) and (440,159.53) .. (440,159.57) ;
  93. \draw [draw opacity=0] (440,159.36) .. controls (440,159.39) and (440,159.42) .. (440,159.46) .. controls (440,170.2) and (397.47,178.91) .. (345,178.91) .. controls (292.53,178.91) and (250,170.2) .. (250,159.46) .. controls (250,159.42) and (250,159.38) .. (250,159.34) -- (345,159.46) -- cycle ; \draw [color={rgb, 255:red, 0; green, 0; blue, 0 } ,draw opacity=1 ] (440,159.36) .. controls (440,159.39) and (440,159.42) .. (440,159.46) .. controls (440,170.2) and (397.47,178.91) .. (345,178.91) .. controls (292.53,178.91) and (250,170.2) .. (250,159.46) .. controls (250,159.42) and (250,159.38) .. (250,159.34) ;
  94. \draw [draw opacity=0][dash pattern={on 4.5pt off 4.5pt}] (256.4,189.71) .. controls (252.35,179.27) and (250.09,167.94) .. (250,156.09) -- (345,155.36) -- cycle ; \draw [dash pattern={on 4.5pt off 4.5pt}] (256.4,189.71) .. controls (252.35,179.27) and (250.09,167.94) .. (250,156.09) ;
  95. \draw [draw opacity=0] (250.11,160.04) .. controls (250.04,158.49) and (250,156.93) .. (250,155.36) .. controls (250,102.9) and (292.53,60.36) .. (345,60.36) .. controls (397.47,60.36) and (440,102.9) .. (440,155.36) .. controls (440,157.58) and (439.92,159.78) .. (439.77,161.96) -- (345,155.36) -- cycle ; \draw (250.11,160.04) .. controls (250.04,158.49) and (250,156.93) .. (250,155.36) .. controls (250,102.9) and (292.53,60.36) .. (345,60.36) .. controls (397.47,60.36) and (440,102.9) .. (440,155.36) .. controls (440,157.58) and (439.92,159.78) .. (439.77,161.96) ;
  96. \draw [draw opacity=0] (433.56,189.39) .. controls (419.82,224.94) and (385.31,250.15) .. (344.92,250.15) .. controls (304.64,250.15) and (270.22,225.09) .. (256.4,189.71) -- (344.92,155.15) -- cycle ; \draw (433.56,189.39) .. controls (419.82,224.94) and (385.31,250.15) .. (344.92,250.15) .. controls (304.64,250.15) and (270.22,225.09) .. (256.4,189.71) ;
  97. \draw [draw opacity=0][dash pattern={on 4.5pt off 4.5pt}] (440,156.03) .. controls (439.92,167.62) and (437.76,178.72) .. (433.88,188.97) -- (345,155.36) -- cycle ; \draw [dash pattern={on 4.5pt off 4.5pt}] (440,156.03) .. controls (439.92,167.62) and (437.76,178.72) .. (433.88,188.97) ;
  98. \draw (247,130) -- (100,190) -- (443,190) -- (590,130) -- (437,130.67) ;
  99. \draw (247,130) -- (253.67,130.67) ;
  100. \draw [dash pattern={on 4.5pt off 4.5pt}] (253.67,130.67) -- (437,130.67) ;
  101. \draw [dash pattern={on 4.5pt off 4.5pt}] (345,60) -- (400.33,104.67) ;
  102. \draw (400.33,104.67) -- (470,160) ;
  103. \draw [draw opacity=0][fill={rgb, 255:red, 0; green, 0; blue, 0 } ,fill opacity=1 ] (467.5,160) .. controls (467.5,158.62) and (468.62,157.5) .. (470,157.5) .. controls (471.38,157.5) and (472.5,158.62) .. (472.5,160) .. controls (472.5,161.38) and (471.38,162.5) .. (470,162.5) .. controls (468.62,162.5) and (467.5,161.38) .. (467.5,160) -- cycle ;
  104. \draw [draw opacity=0][fill={rgb, 255:red, 0; green, 0; blue, 0 } ,fill opacity=1 ] (342.5,159.46) .. controls (342.5,158.08) and (343.62,156.96) .. (345,156.96) .. controls (346.38,156.96) and (347.5,158.08) .. (347.5,159.46) .. controls (347.5,160.84) and (346.38,161.96) .. (345,161.96) .. controls (343.62,161.96) and (342.5,160.84) .. (342.5,159.46) -- cycle ;
  105. \draw (419,72.4) node [anchor=north west][inner sep=0.75pt] {$S^{n}$};
  106. \draw (162.14,166.97) node [anchor=north west][inner sep=0.75pt] {$\mathbb{R}^{n}$};
  107. \draw (351.71,151.97) node [anchor=north west][inner sep=0.75pt] {$0$};
  108. \draw (348,41.69) node [anchor=north west][inner sep=0.75pt] {$1$};
  109. \draw (383.14,98.83) node [anchor=north west][inner sep=0.75pt] {$x$};
  110. \draw (476.86,149.11) node [anchor=north west][inner sep=0.75pt] {$y$};
  111. \draw [fill={rgb, 255:red, 0; green, 0; blue, 0 } ,fill opacity=1 ] (345.45, 60.37) circle [x radius= 2, y radius= 2] ;
  112. \draw [fill={rgb, 255:red, 0; green, 0; blue, 0 } ,fill opacity=1 ] (400.33, 104.67) circle [x radius= 2, y radius= 2] ;
  113. \end{tikzpicture}
  114. \end{center}

效果





LaTex中文article模板(支持代码、数学、TikZ)的更多相关文章

  1. latex中文支持ubuntu

    latex安装: sudo apt install texlive-full 中文字体安装: sudo apt-get install latex-cjk-all      字体包中包含bsmi,bk ...

  2. Latex中文utf-8编码的三种方式

    我们知道Latex一般用CJK和CTEX宏包支持中文编辑,CJK和CTEX的默认编码是GBK,而windows下的默然编码就是GBK,因此CJK和CTEX不需要特殊配置就可以直接支持中文Latex编译 ...

  3. Latex中插入C语言代码

    Latex是一个文本排版的语言,能排版出各种我们想要的效果.而且用代码排版的优点是易于修改板式,因此在文本内容的排版时,Latex应用十分广泛. 当我们需要在Latex中插入代码时,就需要用到 \us ...

  4. Ubuntu下LaTex中文环境安装与配置

    转载自:http://www.linuxidc.com/Linux/2012-06/62456.htm LaTeX是一个强大的排版软件,但是其最初只是为英文排版而设计的.为了使其能够胜任中文排版的重任 ...

  5. (转)关于Tomcat的点点滴滴(体系架构、处理http请求的过程、安装和配置、目录结构、设置压缩和对中文文件名的支持、以及Catalina这个名字的由来……等)

    转自:http://itfish.net/article/41668.html   总结Tomcat的体系架构.处理http请求的过程.安装和配置.目录结构.设置压缩和对中文文件名的支持.以及Cata ...

  6. heredoc(实现模板与代码的分离)

    heredoc(实现模板与代码的分离) 一.总结 heredoc实现模板与代码的分离,实现的是在后台编程语言中批量输出html代码,在这个批量输出的html代码中又可以嵌套编程语言变量.所以很方便. ...

  7. Mac LaTex中文环境搭建

    为了在博客上写公式,折腾了一晚上Mac上的LaTex的环境搭建,本文对步骤进行记录. 系统:Mac OSX 10.10.5 软件准备 1) MacTex 2015 Distribution (Tex的 ...

  8. ASP.NET MVC:多模板支持

    原文 http://www.cnblogs.com/happyframework/p/3224278.html 背景 准备写个博客练习一下WEB编程,有一个需求就是多模板支持,类似博客园的自定义模板一 ...

  9. C++模板类代码只能写在头文件?

      这个问题,实际上我几年前就遇到了.最近写个模板类玩的时候,再次遇到.   当我非常仔细的将定义和实现分开,在头文件中保留了最少的依赖后,一切就绪.cpp单独编过.但是当使用的时候,就会报告所有的函 ...

随机推荐

  1. 记录一次简单的springboot发送邮件功能

    场景:经常在我们系统中有通过邮件功能找回密码,或者发送生日祝福等功能,今天记录下springboot发送邮件的简单功能 1.引入maven <!-- 邮件开发--><dependen ...

  2. Halo博客的搭建

    今日主题:搭建一个私人博客 好多朋友和我说,能不能弄一个简单的私人博客啊,我说行吧,今天给你们一份福利啦! 搭建一个私人博客,就可以在自己的电脑上写博客了 Halo Halo 是一款现代化的个人独立博 ...

  3. Java时间戳获取

    Java时间戳获取方式: 1:New Date().getTime(); 2: System.currentTimeMillis();区别: New Date().getTime()的底层其实是Sys ...

  4. Android 添加键值并上报从驱动到上层

    转载:https://blog.csdn.net/weixin_43854010/article/details/94390803 Android 添加键值并上报从驱动到上层 平台 :RK3288 O ...

  5. Android AndroidManifest.xml详解

    AndroidManifest.xml简述: AndroidManifest.xml 是每个android程序中必须的文件.它位于整个项目的根目录,描述了package中暴露的组件(activitie ...

  6. VSCode——自定义VSCode背景图片

    本文转载自https://blog.csdn.net/yukinoai/article/details/84564949 1.以管理员身份运行VS Code,安装background插件 2.打开se ...

  7. 2017蓝桥杯等差素数(C++B组)

    题目 :                                            等差素数列 2,3,5,7,11,13,....是素数序列.类似:7,37,67,97,127,157 ...

  8. Java中的垃圾回收算法详解

    一.前言   前段时间大致看了一下<深入理解Java虚拟机>这本书,对相关的基础知识有了一定的了解,准备写一写JVM的系列博客,这是第二篇.这篇博客就来谈一谈JVM中使用到的垃圾回收算法. ...

  9. java web之Filter详解

    java web之Filter详解 2012-10-20 0 个评论 作者:chenshufei2 收藏 我要投稿 .概念: Filter也称之为过滤器,它是Servlet技术中比较激动人心的技术,W ...

  10. 发现一款手绘可视化神器!Python绘图还在用Matplotlib?out了 !

    前言 本文的文字及图片来源于网络,仅供学习.交流使用,不具有任何商业用途,版权归原作者所有,如有问题请及时联系我们以作处理. PS:如有需要Python学习资料的小伙伴可以加点击下方链接自行获取htt ...