latex各种宏包总结
程序员文章站
2023-12-27 12:28:03
...
各种宏包:
必备宏包:
\usepackage{amsmath}
\usepackage{amssymb}
\usepackage{booktabs}
\usepackage{float}
\usepackage{multirow}
\usepackage{array}
设置字号且book类型适合单面打印:
\documentclass[11pt, oneside]{book}
在目录中显示chapter:
\usepackage{titletoc}
\titlecontents*{chapter}% <section-type>
[0pt]% <left>
{\addvspace{1em}}% <above-code>
{\bfseries\chaptername\ \thecontentslabel\quad}% <numbered-entry-format>
{}% <numberless-entry-format>
{\bfseries\hfill\contentspage}% <filler-page-format>
页边距:
\usepackage{geometry}
\geometry{left=3.8cm, right=2.5cm, top=2.5cm, bottom=2.5cm}
取消段前空格:
\setlength{\parindent}{0pt}
显示section标号为x.x:
\renewcommand\thesubsection{\thesection.\arabic{subsection}}
设置字体:
\usepackage{fontspec}
\setmainfont{Arial}
设置全局行间距为1.5倍:
\renewcommand{\baselinestretch}{1.5}
引用的格式:
\bibliographystyle{IEEEtran}
chapter的格式:
\usepackage[Sonny]{fncychap}
页码置于最底部
\usepackage{fancyhdr}
\pagestyle{plain} % 此处为fancy时有页眉
\lfoot{}
插入图片路径:
\usepackage{graphicx}
\graphicspath{{figures/}, {pics/}}
设置图片、表格等标题的大小:
\usepackage{caption}
\captionsetup{font={scriptsize}}
关于标题:
\usepackage{titlesec}
\titleformat{\chapter}[block]{\LARGE \bfseries}{Chapter \arabic{chapter}}{1em}{}[]
\titlespacing{\chapter}{0pt}{-2pt}{2pt}
\titleformat{章节命令}[形状]{格式}{标题序号}{序号与标题间距}{标题前命令}[标题后命令]
\titlespacing*{章节命令}{左边距}{上文距}{下文距}[右边距]