参考文献:
- latex中自定义的命令———\newcommand-CSDN博客
- LaTeX技巧924:详解newcommand的参数和默认值 - LaTeX工作室 (latexstudio.net)
文章目录
- (re)newcommand
- 自定义的一些命令
(re)newcommand
”定义命令“ 的定义:
\newcommand{<命令>}[<参数个数>][<首参数默认值>]{<具体的定义>}
例子:
\newcommand{\Rdef}[2][m]{\mathbb{Z}_{#2}[X]/(\Phi_{#1}(X))}
\[
\Rdef{p},
\,\,
\Rdef[m/2]{q}
\]
效果:
自定义的一些命令
模板:
% IACR Transactions CLASS DOCUMENTATION
\documentclass[]{iacrtrans}
\usepackage[utf8]{inputenc}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\usepackage{xspace}
\usepackage{array,tabularx,longtable}
\usepackage{booktabs,hyperref,,url}
\usepackage{graphicx}
\usepackage{appendix}
\usepackage{CJKutf8}
\usepackage{amsfonts,amssymb,amsmath,amsthm}
\usepackage{algorithm,algorithmicx,algpseudocode}
\renewcommand{\algorithmicrequire}{\textbf{Input:}}
\renewcommand{\algorithmicensure}{\textbf{Output:}}
\usepackage[
backend=bibtex,
giveninits=true,
style=alphabetic, %numeric
sorting=nyt, %ynt
]{biblatex}
\addbibresource{reference.bib}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% 作者 & 机构 & 邮件
\author{author A \inst{1}
\and author B \inst{2}}
\institute{UCAS, \email{@iie.ac.cn}
\and UCAS, \email{@iie.ac.cn}}
% 页眉 & 标题
\title[\texttt{iacrtans} class documentation]{My Title}
% 排版 & 编码
\raggedbottom
\allowdisplaybreaks[4]
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%\newcommand{cmd}[arg-num][first-arg]{def}
% 群环域
\newcommand{\NN}{\mathbb{N}}
\newcommand{\ZZ}{\mathbb{Z}}
\newcommand{\QQ}{\mathbb{Q}}
\newcommand{\RR}{\mathbb{R}}
\newcommand{\CC}{\mathbb{C}}
\renewcommand{\AA}{\mathbb{A}}
\newcommand{\BB}{\mathbb{B}}
\newcommand{\LL}{\mathbb{L}}
\newcommand{\R}{\mathcal{R}}
\renewcommand{\S}{\mathcal{S}}
\newcommand{\GF}{\mathsf{GF}}
\newcommand{\Gal}{\mathcal{G}\mathsf{al}}
\newcommand{\grp}[1]{\langle #1 \rangle}
\newcommand{\ord}{\mathsf{ord}}
% 算数
\newcommand{\inner}[2]{\left\langle #1, #2 \right\rangle}
\newcommand{\round}[1]{\left\lfloor #1 \right\rceil}
\newcommand{\ceil}[1]{\left\lceil #1 \right\rceil}
\newcommand{\floor}[1]{\left\lfloor #1 \right\rfloor}
% 分布
\newcommand{\U}{\mathcal{U}}
\renewcommand{\Pr}{\ensuremath{\textup{Pr}}}
\newcommand{\negl}{\ensuremath{\textup{negl}}}
% 密文
\renewcommand{\a}{\mathbf{a}}
\renewcommand{\b}{\mathbf{b}}
\renewcommand{\c}{\mathbf{c}}
\newcommand{\s}{\mathbf{s}}
\newcommand{\e}{\mathbf{e}}
\newcommand{\m}{\mathbf{m}}
\newcommand{\sk}{\mathbf{sk}}
\newcommand{\pk}{\mathbf{pk}}
\newcommand{\pt}{\mathbf{pt}}
\newcommand{\ct}{\mathbf{ct}}
\newcommand{\Enc}{\ensuremath{\textup{Enc}}}
\newcommand{\Dec}{\ensuremath{\textup{Dec}}}
\newcommand{\Eval}{\ensuremath{\textup{Eval}}}
\newcommand{\LWE}{\ensuremath{\textup{LWE}}}
\newcommand{\RLWE}{\ensuremath{\textup{RLWE}}}
\newcommand{\MLWE}{\ensuremath{\textup{MLWE}}}
\newcommand{\GSW}{\ensuremath{\textup{GSW}}}
\newcommand{\RGSW}{\ensuremath{\textup{RGSW}}}
\newcommand{\MGSW}{\ensuremath{\textup{MGSW}}}
\newcommand{\RNS}{\mathsf{RNS}}
\newcommand{\CRT}{\mathsf{CRT}}
\newcommand{\DCRT}{\mathsf{DoubleCRT}}
% 运算
\newcommand{\Enc}{\ensuremath{\textup{Enc}}}
\newcommand{\Dec}{\ensuremath{\textup{Dec}}}
\newcommand{\Eval}{\ensuremath{\textup{Eval}}}
\newcommand{\Refresh}{\ensuremath{{\mathsf{Refresh}}}}
\newcommand{\Add}{\mathsf{Add}}
\newcommand{\Mult}{\mathsf{Mult}}
\newcommand{\Frobenius}{\ensuremath{{\mathsf{Frobenius}}}}
\newcommand{\Rotate}{\mathsf{Rotate}}
\newcommand{\Permute}{\mathsf{Permute}}
\newcommand{\SwitchKey}{\ensuremath{\mathsf{SwitchKey}}}
\newcommand{\ModUp}{\ensuremath{\mathsf{ModUp}}}
\newcommand{\ModDown}{\ensuremath{\mathsf{ModDown}}}
\newcommand{\ModScale}{\ensuremath{\mathsf{ModScale}}}
\newcommand{\BitDecomp}{\ensuremath{{\mathsf{BitDecomp}}}}
\newcommand{\PowersTwo}{\ensuremath{{\mathsf{Powersof2}}}}
\newcommand{\Pack}{\ensuremath{{\mathsf{Pack}}}}
\newcommand{\Unpack}{\ensuremath{{\mathsf{Unpack}}}}
% 多项式
\newcommand{\f}{\mathbf{f}}
\newcommand{\g}{\mathbf{g}}
\newcommand{\h}{\mathbf{h}}
% 向量
\newcommand{\va}{\vec{a}}
\newcommand{\vb}{\vec{a}}
\newcommand{\vc}{\vec{c}}
% 复杂度
\newcommand{\polylog}{\ensuremath{\textup{polylog}}}
\newcommand{\poly}{\ensuremath{\textup{poly}}}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{document}
\begin{CJK}{UTF8}{gbsn}
\maketitle
% use optional argument because the \LaTeX command breaks the PDF keywords
\keywords[]{
关键字
}
\begin{abstract}
摘要
\end{abstract}
% Print Contents
\tableofcontents{}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\section{Introduction}
简单测试:
$\R, \R_{q^l}, \ZZ$
$\S,\AA$
$\round{\frac{1}{2}}, \ceil{123.456}$
$\GF(p), \Gal(x)$
$\poly(n), \polylog(m), \log(k)$
$\ct, \a, \c, \va$
$\RNS, \DCRT$
$\Pr[a], \negl(n)$
$\RLWE, \GSW$
$\ZZ/\grp{2}, \ord(a)=7$
$\inner{\s}{\frac{\c}{2}}$
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\nocite{*}
\printbibliography
\end{CJK}
\end{document}