mac latex使用记录

https://zhuanlan.zhihu.com/p/35498361
推荐了两个神器,准备先试试
https://tex.stackexchange.com/questions/307483/setting-up-basictex-homebrew

一、安装basictex(推荐不要装这个)

brew cask install basictex
cd /usr/local/Caskroom/basictex/2018.0417
open mactex-basictex-20180417.pkg

二、安装编辑器

https://sourceforge.net/projects/texstudio/files/latest/download

三、使用或者编辑

3.1.编辑器

http://liuchengxu.org/blog-cn/posts/quick-latex/
从零开始latex入门
使用中文的话看这个
https://www.zhihu.com/question/22906637
可以不用去装什么CJK的包

3.2.命令行

https://www.ouyangsong.com/posts/57080/
xelatex resume-zh_CN.tex

四、使用ppt模版

4.1模板库

https://www.overleaf.com/latex/templates/beamer-presentation/zxrfltwmbcrt
https://www.latexstudio.net/

4.2测试样例
%!TEX program = xelatex
%!TEX TS-program = xelatex
%!TEX encoding = UTF-8 Unicode
\documentclass{beamer}
%
% Choose how your presentation looks.
%
% For more themes, color themes and font themes, see:
% http://deic.uab.es/~iblanes/beamer_gallery/index_by_theme.html
%
\mode<presentation>
{
	\usetheme{Darmstadt}      % or try Darmstadt, Madrid, Warsaw, ...
	\usecolortheme{beaver} % or try albatross, beaver, crane, ...
	\usefonttheme{serif}  % or try serif, structurebold, ...
	\setbeamertemplate{navigation symbols}{}
	\setbeamertemplate{caption}[numbered]
} 

%\documentclass[12pt]{article} %这个我就不多说了,头文件
\usepackage{url} %这个我也不多说了
\usepackage{fontspec,xltxtra,xunicode} %最新的mactex都有
\usepackage[english]{babel}
\usepackage[utf8x]{inputenc}
\defaultfontfeatures{Mapping=tex-text}
\setromanfont{Heiti SC} %设置中文字体
\XeTeXlinebreaklocale “zh”
\XeTeXlinebreakskip = 0pt plus 1pt minus 0.1pt %文章内中文自动换行,可以自行调节


\title[Your Short Title]{欢迎来到cnn的世界}
\author{毅兴}
\institute{hx133330@alibaba-inc.com}
\date{2018.14.13}

\begin{document}
	
	\begin{frame}
	\titlepage
\end{frame}

% Uncomment these lines for an automatically generated outline.
%\begin{frame}{Outline}
%  \tableofcontents
%\end{frame}

%第一章

\begin{frame}{第一章 介绍}

\begin{itemize}
	\item 第一点
	\item 第二\textbf{}
\end{itemize}

\vskip 1cm

\begin{block}{举例}
	Some examples of commonly used commands and features are included, to help you get started.
\end{block}

\end{frame}


%第二章



\begin{frame}{第二章}

\begin{itemize}
\item Use \texttt{tabular} for basic tables --- see Table~\ref{tab:widgets}, for example.
\item You can upload a figure (JPEG, PNG or PDF) using the files menu. 
\item To include it in your document, use the \texttt{includegraphics} command (see the comment below in the source code).
\end{itemize}

% Commands to include a figure:
%\begin{figure}
%\includegraphics[width=\textwidth]{your-figure's-file-name}
%\caption{\label{fig:your-figure}Caption goes here.}
%\end{figure}

\begin{table}
\centering
\begin{tabular}{l|r}
	Item & Quantity \\\hline
	Widgets & 42 \\
	Gadgets & 13
\end{tabular}
\caption{\label{tab:widgets}An example table.}
\end{table}

\end{frame}


%第三章

\begin{frame}{第三章}

Let $X_1, X_2, \ldots, X_n$ be a sequence of independent and identically distributed random variables with $\text{E}[X_i] = \mu$ and $\text{Var}[X_i] = \sigma^2 < \infty$, and let
$$S_n = \frac{X_1 + X_2 + \cdots + X_n}{n}
= \frac{1}{n}\sum_{i}^{n} X_i$$
denote their mean. Then as $n$ approaches infinity, the random variables $\sqrt{n}(S_n - \mu)$ converge in distribution to a normal $\mathcal{N}(0, \sigma^2)$.


\end{frame}

%第四章


\begin{frame}{第四章}

Let $X_1, X_2, \ldots, X_n$ be a sequence of independent and identically distributed random variables with $\text{E}[X_i] = \mu$ and $\text{Var}[X_i] = \sigma^2 < \infty$, and let
$$S_n = \frac{X_1 + X_2 + \cdots + X_n}{n}
= \frac{1}{n}\sum_{i}^{n} X_i$$
denote their mean. Then as $n$ approaches infinity, the random variables $\sqrt{n}(S_n - \mu)$ converge in distribution to a normal $\mathcal{N}(0, \sigma^2)$.


\end{frame}

\end{document}

执行会报错

Font OT1/phv/m/n/10.95=phvr7t at 10.95pt not loadable: Metric (TFM) file not found. \begin{document}

解决办法

sudo tlmgr install collection-fontsrecommended collection-fontsextra

https://tex.stackexchange.com/questions/269927/metric-tfm-file-not-found-error-only-in-texstudio-under-mac-os-x

五、添加.sty文件

下载.sty文件然后复制到这里
/usr/local/texlive/2018basic/texmf-dist/tex/latex/base
sudo texhash
或者
sudo tlmgr install gen­misc
安装相应的包

六、example 2

%!TEX program = xelatex
%!TEX TS-program = xelatex
%!TEX encoding = UTF-8 Unicode
\documentclass{beamer}	% Compile at least twice!
%\setbeamertemplate{navigation symbols}{}
\usetheme{Warsaw}
%\useinnertheme{rectangles}
%\useoutertheme{infolines}
\useoutertheme[title,section,subsection=true]{smoothbars}

% -------------------
% Packages
% -------------------
\usepackage{
   amsmath,			% Math Environments
   amssymb,			% Extended Symbols
   enumerate,		    % Enumerate Environments
   graphicx,			% Include Images
   %lastpage,			% Reference Lastpage
   multicol,			% Use Multi-columns
   %multirow,			% Use Multi-rows
   pifont,			    % For Checkmarks
   %stmaryrd			% For brackets
}
\usepackage[english]{babel}


% -------------------
% Colors
% -------------------
\definecolor{UniOrange}{RGB}{212,69,0}
\definecolor{UniGray}{RGB}{62,61,60}
%\definecolor{UniRed}{HTML}{B31B1B}
%\definecolor{UniGray}{HTML}{222222}
\setbeamercolor{title}{fg=UniGray}
\setbeamercolor{frametitle}{fg=UniOrange}
\setbeamercolor{structure}{fg=UniOrange}
\setbeamercolor{section in head/foot}{bg=UniGray}
\setbeamercolor{author in head/foot}{bg=UniGray}
\setbeamercolor{date in head/foot}{fg=UniGray}
\setbeamercolor{structure}{fg=UniOrange}
\setbeamercolor{local structure}{fg=black}
\beamersetuncovermixins{\opaqueness<1>{0}}{\opaqueness<2->{15}}

% -------------------
% Fonts & Layout
% -------------------
\useinnertheme{default}
\usefonttheme{serif}
\usepackage{palatino}
\setbeamerfont{title like}{shape=\scshape}
\setbeamerfont{frametitle}{shape=\scshape}
\setbeamertemplate{itemize items}[circle]
%\setbeamertemplate{enumerate items}[default]


% -------------------
% Commands
% -------------------

% Special Characters
\newcommand{\N}{\mathbb{N}}
\newcommand{\Z}{\mathbb{Z}}
\newcommand{\Q}{\mathbb{Q}}
\newcommand{\R}{\mathbb{R}}
\newcommand{\C}{\mathbb{C}}

% Math Operators
\DeclareMathOperator{\im}{im}
\DeclareMathOperator{\Span}{span}

% Special Commands
\newcommand{\pf}{\noindent\emph{Proof. }}
\newcommand{\ds}{\displaystyle}
\newcommand{\defeq}{\stackrel{\text{def}}{=}}
\newcommand{\ov}[1]{\overline{#1}}
\newcommand{\ma}[1]{\stackrel{#1}{\longrightarrow}}
\newcommand{\twomatrix}[4]{\begin{pmatrix} #1 & #2 \\ #3 & #4 \end{pmatrix}}


% -------------------
% Tikz & PGF
% -------------------
\usepackage{tikz}
%\usepackage{tikz-cd}
\usetikzlibrary{
   calc,
   decorations.pathmorphing,
   matrix,arrows,
   positioning,
   shapes.geometric
}
%\usepackage{pgfplots}
%\pgfplotsset{compat=newest}


% -------------------
% Theorem Environments
% -------------------
\theoremstyle{plain}
\newtheorem{thm}{Theorem}[section]
\newtheorem{prop}{Proposition}[section]
\newtheorem{lem}{Lemma}[section]
\newtheorem{cor}{Corollary}[section]
\theoremstyle{definition}
\newtheorem{ex}{Example}[section]
\newtheorem{nex}{Non-Example}[section]
\newtheorem{dfn}{Definition}[section]
\theoremstyle{remark}
\newtheorem{rem}{Remark}[section] 
\numberwithin{equation}{section}
%\documentclass[12pt]{article} %这个我就不多说了,头文件
\usepackage{url} %这个我也不多说了
\usepackage{fontspec,xltxtra,xunicode} %最新的mactex都有
\usepackage[english]{babel}
\usepackage[utf8x]{inputenc}
\defaultfontfeatures{Mapping=tex-text}
\setromanfont{Heiti SC} %设置中文字体
\XeTeXlinebreaklocale “zh”
\XeTeXlinebreakskip = 0pt plus 1pt minus 0.1pt %文章内中文自动换行,可以自行调节


% -------------------
% Title Page
% -------------------
\title{\textcolor{white}{欢迎来到cnn的世界}}
\subtitle{\textcolor{white}{Mathematics Conference for the Mysterious and Magical}}  
\author{毅兴}
\date{April 1, 2020} 


% -------------------
% Content
% -------------------
\begin{document}


% Title Page
\begin{frame}
\titlepage
\end{frame}



% Motivation
\section{Motivation}



% My Motivation 
\begin{frame}
ni hMy motivation in giving this talk is to get a Ph.D. \dots
\end{frame}



% Definitions & Examples
\begin{frame}
Here is my definition\dots
ni hao

\begin{dfn}[Ph.D.]
A Ph.D. is something you sweat and cry for.
\end{dfn}

\begin{ex}
I studied so hard for my qualifying exam I replaced my childhood memories with an entire chapter of Hartshorne's \emph{Algebraic Geometry}.
\end{ex}
\end{frame}



% Main Results
\section{Main Results}



% Theorem
\begin{frame}
\begin{thm}[D.]
For all $n$, we have $n^2= n \cdot n$.
\end{thm}

\pf With massive loss of generality, let $n=1$. Then we have
   \[
   1=1^2= 1 \cdot 1= 1
   \]
Therefore by overwhelming hope, it must always be true. \qed
\end{frame}



% Corollary
\begin{frame}
Most algebra you need to be true is true.
\begin{cor}
For all $n,m \in \N$, $(n+m)^2= n^2 + m^2$.
\end{cor}
\end{frame}



% Applications
\section{Applications}



% Application 1
\begin{frame}
   \begin{enumerate}[1.]
   \item Bleach is mostly water. \pause
   \item We are mostly water. \pause
   \item Therefore, we are bleach.
   \end{enumerate} \vspace{0.5cm}

Now we pause for the big reveal\dots \pause \vspace{0.3cm}

   \begin{itemize}
   \item I am clearly a master of logic.
   \item Masters of logic get Ph.D's.
   \item I have earned this.
   \end{itemize}
\end{frame}



% Math
\begin{frame}
Finally! Some Math! \vspace{1cm}

Here is some Math: $\int_1^\alpha \dfrac{x^2}{\sin x^2} \;dx$ and $\sum i^2$. \vspace{1cm}

But you could make this Math big inline with `displaystyle': $\ds \int_1^\alpha \dfrac{x^2}{\sin x^2} \;dx$ and $\ds \sum i^2$. \vspace{1cm}

And even more Math:
   \[
   \oint \vec{\nabla} \times \vec{F} \;dV = \sum_{n=1}^\infty \ov{p} \twomatrix{a}{b}{c}{d}
   \]
\end{frame}



% Conclusion
\section{Conclusion}



% End Slide
\begin{frame}
Ph.D. plz\dots
\end{frame}



% Questions
\begin{frame}
\begin{center} {\bfseries \Large Questions?} \end{center}
\end{frame}


\end{document}

七、参考

https://www.ouyangsong.com/posts/57080/
MacTeX添加.sty文件
https://blog.csdn.net/qingdujun/article/details/80914240
MAC下Basictex如何安装宏包
https://blog.csdn.net/zgl07/article/details/49966237
其他一些模版
http://www.latextemplates.com/

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值