Latex Document的一些代码片段

血红的双手。 提交于 2019-12-15 14:16:47

【推荐】2019 Java 开发者跳槽指南.pdf(吐血整理) >>>

分享并记录一些latex document的一些代码片段,方便了自己也方便了别人。。。代码的环境是与LaTeX beamer 一些常用的指令 中是一样的。

  • Latex document中文模板
\documentclass{article}
\usepackage{ctex}
\title{周总结-\today}
\author{作者\thanks{关于作者的脚注}}
\usepackage{tikz}
\usepackage{url}
\usepackage{cite}
\usepackage{xcolor}
\usepackage[unicode]{hyperref}
\usetikzlibrary{shapes,arrows,chains}
%  \title{}  
%  \thanks{}  
%  \footnotetext{}  
%  \author{}  
%  \date{}  
%  \maketitle  
%  \tableofcontents 
\renewcommand{\refname}{参考文献}
\begin{document}
	\maketitle
	\tableofcontents
	\section{大标题}
	% \subsection{小标题} %被注释掉的小标题
	%注释

      %被注释掉的参考文献
		%\bibliographystyle{unsrt}
	%\bibliography{20170217}
   
\end{document}
  • latex的表格代码
 \begin{table}
     \caption{问题解决对比实验}
	  	\begin{center}
	  		\begin{tabular}{||c|c||} \hline  
	  			\emph{模型来源} & \emph{导入结果} \\  \hline
	  			WareHouse分享的模型 & 正常 \\ \hline
	  			直接使用Sketch Up建模的模型并渲染 & 正常 \\ \hline
	  			将Match Photo后的模型分享到Warehouse上后下载 & 异常 \\ \hline
	  			将Match Photo建立的模型的一部分 & Sketch Up渲染的显示正常,   \\  
	  			Faces使用SketchUp的纹理进行渲染 & 直接从Photo 渲染的显示异常 \\ \hline
	  		\end{tabular}
	  	\end{center}
\end{table}

效果如下图:

  • 有时候在写latex document的时候,需要将相关的图片恰好放在latex 图片代码的位置,可以按照下面的方式来实现:
#在引言部分加入需要的宏包 float
\usepackage{float}

#在插入图片的位置处的\begin{figure}后面加[H],如下:


	\begin{figure}[H]
		\centering
		\includegraphics[width=1\linewidth]{img_name}
		\caption{caption}
		\label{fig:img_name}# label of the image,this is useful when you want to cite the image 
	\end{figure}
	
  • 在文章中进行引用的链接与反链接
\usepackage[pagebackref,colorlinks]{hyperref}

%其中pagebackref实现从参考文献列表反连接到文中引用该文献的位置
%colorlinks实现的是将引用链接用相应的颜色进行标记而不是矩形框进行标记
  • 在文章中并列排布多个子图
%在导言部分引入subfig package
\usepackage{subfig}

%在正文部分

\begin{figure}[thb]
	\centering
	\subfloat[subtitle]{
		\includegraphics[width=6cm,height=4cm]{figure_path}
	}
	\subfloat[subtitle]{
		\includegraphics[width=6cm,height=4cm]{figure_path}
	}
	\subfloat[subtitle]{
		\includegraphics[width=6cm,height=4cm]{figure_path}
	}
\caption{title of the figure }
\label{fig:label}
\end{figure}

  • align 数学公式环境下:

不使用标号的情况可以直接 加 \notag 

自己需要重新标号 直接 \tag{编号}

以后会逐渐更新其他的一些代码片段...

存在问题解决:

  1. 在macos 出现问题“Package fontspec Error: The font "KaitiSC" cannot be found.”的解决办法,参考一个给LuaTeX用户的提醒 ,给出的路径与我实际的不是很相符,可能是又升级了一次,所以我的路径是:
    	/System/Library/Assets/com_apple_MobileAsset_Font5
    
    然后进行按照参考链接后就正常了。
    	tlmgr conf texmf OSFONTDIR /System/Library/Assets/com_apple_MobileAsset_Font5/
    
标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!