LaTeX讲解系列(4): LaTex Preamble区中usepackage常用总结

LaTeX讲解系列(4): LaTex Preamble区中usepackage常用总结

  1. 这些必须引:

    1
    2
    \usepackage{graphicx}
    \usepackage{amsmath}
  2. 使用\cref{}时要引用\usepackage{cleveref}。而且这个命令的位置一定一定要在定义/引用所有的包的最后再import进来,不然会出现奇怪的问题(无法正常超链接等)。举个栗子,比如要在hyperref之后usepackage进来。

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    % ......
    \definecolor{cvprblue}{rgb}{0.21,0.49,0.74}
    \usepackage[pagebackref,breaklinks,colorlinks,allcolors=cvprblue]{hyperref}

    %%%%%%%%% ADD CREF AT LAST, ESPECIALLY AFTER HYPERREF
    \usepackage{cleveref}
    % add support for algorithm env
    \crefname{algorithm}{Alg.}{Algs.}
    \Crefname{algorithm}{Alg.}{Algs.}

    \crefname{figure}{Fig.}{Figs.}
    \Crefname{figure}{Fig.}{Figs.}

    \crefname{table}{Tab.}{Tabs.}
    \Crefname{table}{Tab.}{Tabs.}

    \crefname{align}{Eq.}{Eqs.}
    \Crefname{align}{Eq.}{Eqs.}

    \crefname{equation}{Eq.}{Eqs.}
    \Crefname{equation}{Eq.}{Eqs.}

    其中\crefname\Crefname是用于自动对相应的环境替换为自己想要的缩写的,比如引用到公式环境时替换为Eq. (编号)等。

  3. 使用表格时把这几个常用的包引上:

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    % This package is useful for creating more readable and organized tables by allowing flexible content formatting within cells.It allows you to:
    % Line Breaks in Cells: Use \makecell{} to create line breaks within a single cell.
    % Custom Alignment: Easily control horizontal and vertical alignment.
    % Multi-line Headers: Create complex table headers with multiple lines.
    \usepackage{makecell}


    % Underlining: Use \uline{text} for a single underline.
    % Double Underlining: Use \uuline{text} for a double underline.
    %Strikethrough: Use \sout{text} for a strikethrough.
    % Wave Underline: Use \uwave{text} for a wavy underline.
    % 比如表格里比较Performance的时候,最好的结果加粗,第二好的结果下划线。
    \usepackage[normalem]{ulem}


    % supertabular:Allows tables to span multiple pages.Usage: Similar to the standard tabular environment, but can handle longer tables that need to continue onto subsequent pages.
    % booktabs:Provides enhanced table rules (lines) for professional-quality tables. Offers commands like \toprule, \midrule, and \bottomrule for creating aesthetically pleasing horizontal lines without vertical lines, following typesetting rules for better readability.
    \usepackage{supertabular,booktabs}

LaTeX讲解系列(4): LaTex Preamble区中usepackage常用总结
https://oier99.cn/posts/f55a32b3/
作者
Oier99
发布于
2024年11月10日
许可协议