home archives github knives links
tags latex
categories
only title title and content
latex笔记

以下均只用CTeX使用过

排版

调整行距,x为倍数

\renewcommand{\baselinestretch}{x}\normalsize

修改页边距,详细

\usepackage{geometry}
\geometry{a4paper,left=2cm,right=2cm,top=1cm,bottom=1cm}

页码,更多

\pagestyle{type(不要页码就写empty)}

设置样式

\thispagestyle{type}

页面大小与页边距

\usepackage{geometry}
\special{papersize=1cm,1cm}
\begin{document}
...

正文取消缩进

\raggedright

section取消缩进

\CTEXsetup[format={\Large\bfseries}]{section}

不要用bftext

表格

特定位置横线:

\cline{x-y}

合并行?

\multirow{num}{width(通常为*)}{文字} (要\usepackage{multirow})

下几行被合并的内容~?

和并列\multicolumn{num}{|c|(这里是格式吗)}{文字}

调整表格行距的骚操作:

\usepackage{booktabs}
\specialrule{0em}{0pt}{3pt}
{线宽}{与上方距离}{与下方距离}(线宽为0则透明)

链接

section取消标号同时保持链接(用一次即可)

\setcounter{secnumdepth}{-number}

颜色

颜色网站colors

\definecolor{brightpink}{rgb}{1.0, 0.0, 0.5}

背景颜色

\pagecolor{ao}
\pagecolor[rgb]{0.0 0.0 0.0}

链接(任意)

\hyperlink{target}{show}
\hypertarget{target}{show}

设定(tableofcontentssection)

\usepackage[colorlinks,linkcolor=green,anchorcolor=blue,citecolor=green,CJKbookmarks=True]{hyperref}
\tableofcontents

超链接

overleaf

代码

插入c代码

\usepackage{listings}
\usepackage{fontspec}
\newfontfamily\DejaVu{DejaVu Sans Mono for Powerline}
\def\codes{\DejaVu\small}
\lstset{
language={[ANSI]C},
%行号
numbers=left,
rulesepcolor=\color{red!20!green!20!blue!20},
escapeinside=``,
%背景色
%backgroundcolor=\color[RGB]{245,245,244},
%样式
basicstyle=\codes,
keywordstyle=\color{blue}\bf\codes,
identifierstyle=\bf\codes,
numberstyle=\color[RGB]{0,192,192}\bf\codes,
commentstyle=\color[RGB]{96,96,96}\codes,
stringstyle=\color[RGB]{128,0,0}\codes,
%显示空格
showstringspaces=false
extendedchars=false %这一条命令可以解决代码跨页时,章节标题,页眉等汉字不显示的问题
}

以下只在xelatex上测试过

表格

统一修改表格间距

%% 列间距
\setlength{\tabcolsep}{20pt}
%% 行间距
\renewcommand{\arraystretch}{0.1}

表格内垂直水平居中

\usepackage{array}
\begin{tabular}{m{4cm}<{\centering}m{2.5cm}<{\centering}m{2.5cm}<{\centering}m{2.5cm}<{\centering}m{2.5cm}<{\centering}}
%% m后面是固定宽度