1 Star 0 Fork 0

dataguru/nwafuthesis

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
zhlineskip.sty 6.82 KB
一键复制 编辑 原始数据 按行查看 历史
nangeng 提交于 2019-12-18 09:32 . 创建毕业论文gitee版仓库
%
% Copyright (C) 2018 by Ruixi Zhang <ruixizhang42@gmail.com>
%
% This work may be distributed and/or modified under the
% conditions of the LaTeX Project Public License, either version 1.3c
% of this license or (at your option) any later version.
% The latest version of this license is in
% https://www.latex-project.org/lppl.txt
% and version 1.3c or later is part of all distributions of LaTeX
% version 2005/12/01 or later.
%
% This work has the LPPL maintenance status `maintained'.
%
% The Current Maintainer of this work is Ruixi Zhang.
%
% This work consists of the files zhlineskip.sty,
% zhlineskip-man.tex,
% zhlineskip-test.tex,
% Latinmetrics.pdf,
% CJKmetrics.pdf,
% README.md
% and the derived file zhlineskip-man.pdf.
%
\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{zhlineskip}[%
2018/11/30 v1.0d Line spacing for CJK documents]
\RequirePackage{kvoptions}
\RequirePackage{xintexpr}
\RequirePackage{etoolbox}
\SetupKeyvalOptions{
family=ZhLS,
prefix=ZhLS@
}
\DeclareStringOption[1.5]{bodytextleadingratio}[1.5]
\DeclareStringOption[1.48]{footnoteleadingratio}[1.48]
\DeclareBoolOption[true]{restoremathleading}
\DeclareBoolOption[false]{UseMSWordMultipleLineSpacing}
\DeclareStringOption[1.15]{MSWordLineSpacingMultiple}[1.15]
\DeclareStringOption[1.296875]{MSWordSinglespaceRatio}[1.296875]
\DeclareDefaultOption{%
\PackageError{\@currname}{%
Unknown option `\CurrentOption'%
}{%
Available package options are:\MessageBreak
\space\space`bodytextleadingratio',\MessageBreak
\space\space`footnoteleadingratio',\MessageBreak
\space\space`restoremathleading',\MessageBreak
\space\space`UseMSWordMultipleLineSpacing',\MessageBreak
\space\space`MSWordLineSpacingMultiple',\MessageBreak
\space\space`MSWordSinglespaceRatio'%
}%
}
\ProcessKeyvalOptions*
\begingroup
\normalsize
\@tempdima\f@size\p@
\@tempdimb\f@baselineskip
\edef\@tempnuma{\the\numexpr\@tempdima\relax}%
\ifZhLS@UseMSWordMultipleLineSpacing
\PackageWarningNoLine{\@currname}{%
Use Microsoft Word multiple line spacing\MessageBreak
Singlespace to fontsize ratio = `\ZhLS@MSWordSinglespaceRatio'\MessageBreak
Multiple = `\ZhLS@MSWordLineSpacingMultiple'%
}%
\xdef\ZhLS@targetbodyleading{%
\@tempnuma*\ZhLS@MSWordSinglespaceRatio*\ZhLS@MSWordLineSpacingMultiple
}%
\else
\xdef\ZhLS@targetbodyleading{%
\@tempnuma*\ZhLS@bodytextleadingratio
}%
\fi
\xdef\ZhLS@defaultbodyleading{\the\numexpr\@tempdimb\relax}%
\endgroup
\begingroup
\footnotesize
\@tempdima\f@size\p@
\@tempdimb\f@baselineskip
\edef\@tempnuma{\the\numexpr\@tempdima\relax}%
\ifZhLS@UseMSWordMultipleLineSpacing
\xdef\ZhLS@targetfootleading{%
\@tempnuma*\ZhLS@MSWordSinglespaceRatio*\ZhLS@MSWordLineSpacingMultiple
}%
\else
\xdef\ZhLS@targetfootleading{%
\@tempnuma*\ZhLS@footnoteleadingratio
}%
\fi
\xdef\ZhLS@defaultfootleading{\the\numexpr\@tempdimb\relax}%
\endgroup
\edef\ZhLS@bodylinespread{%
\xintthefloatexpr\xintexpr
\ZhLS@targetbodyleading/\ZhLS@defaultbodyleading\relax\relax
}
\edef\ZhLS@footlinespread{%
\xintthefloatexpr\xintexpr
\ZhLS@targetfootleading/\ZhLS@defaultfootleading\relax\relax
}
\linespread{\ZhLS@bodylinespread}\selectfont
\patchcmd\@footnotetext
{\reset@font}
{\def\baselinestretch{\ZhLS@footlinespread}\reset@font}
{}{}
\patchcmd\@mpfootnotetext
{\reset@font}
{\def\baselinestretch{\ZhLS@footlinespread}\reset@font}
{}{}
\def\ZhLS@resetfootnotesep#1{%
\begingroup
\footnotesize
\linespread{#1}\selectfont
\global\footnotesep=\ht\strutbox
\endgroup
}
\ZhLS@resetfootnotesep{\ZhLS@footlinespread}
\newcommand*\SetTextEnvironmentSinglespace[1]{%
\def\ZhLS@textlinespread{#1}%
}
\SetTextEnvironmentSinglespace{1}
\newcommand*\RestoreTextEnvironmentLeading{%
\ZhLS@restoretextenvironmentleading
}
\def\ZhLS@restoretextenvironmentleading#1{%
\AtBeginEnvironment{#1}{%
\linespread{\ZhLS@textlinespread}\selectfont\ignorespaces
}%
}
\ifZhLS@restoremathleading
\RequirePackage{mathtools}
\newcommand*\SetMathEnvironmentSinglespace[1]{%
\def\ZhLS@mathlinespread{#1}%
}
\SetMathEnvironmentSinglespace{1}
\newcommand*\RestoreMathEnvironmentLeading{%
\ZhLS@restoremathenvironmentleading
}
\def\ZhLS@restoremathenvironmentleading#1{%
\AtBeginEnvironment{#1}{%
\linespread{\ZhLS@mathlinespread}\selectfont\ignorespaces
}%
}
\RestoreMathEnvironmentLeading{array}
\RestoreMathEnvironmentLeading{matrix}
\RestoreMathEnvironmentLeading{pmatrix}
\RestoreMathEnvironmentLeading{bmatrix}
\RestoreMathEnvironmentLeading{Bmatrix}
\RestoreMathEnvironmentLeading{vmatrix}
\RestoreMathEnvironmentLeading{Vmatrix}
\RestoreMathEnvironmentLeading{cases}
\RestoreMathEnvironmentLeading{aligned}
\RestoreMathEnvironmentLeading{alignedat}
\RestoreMathEnvironmentLeading{gathered}
\patchcmd\start@gather
{\collect@body}
{\linespread{\ZhLS@mathlinespread}\selectfont\collect@body}
{}{}
\patchcmd\start@align
{\collect@body}
{\linespread{\ZhLS@mathlinespread}\selectfont\collect@body}
{}{}
\patchcmd\start@multline
{\collect@body}
{\linespread{\ZhLS@mathlinespread}\selectfont\collect@body}
{}{}
\patchcmd\gather@split
{\spread@equation}
{\linespread{\ZhLS@mathlinespread}\selectfont\spread@equation}
{}{}
\RestoreMathEnvironmentLeading{matrix*}
\RestoreMathEnvironmentLeading{pmatrix*}
\RestoreMathEnvironmentLeading{bmatrix*}
\RestoreMathEnvironmentLeading{Bmatrix*}
\RestoreMathEnvironmentLeading{vmatrix*}
\RestoreMathEnvironmentLeading{Vmatrix*}
\RestoreMathEnvironmentLeading{cases*}
\RestoreMathEnvironmentLeading{dcases}
\RestoreMathEnvironmentLeading{dcases*}
\RestoreMathEnvironmentLeading{rcases}
\RestoreMathEnvironmentLeading{rcases*}
\RestoreMathEnvironmentLeading{drcases}
\RestoreMathEnvironmentLeading{drcases*}
\RestoreMathEnvironmentLeading{multlined}
\RestoreMathEnvironmentLeading{lgathered}
\RestoreMathEnvironmentLeading{rgathered}
\else
\PackageWarningNoLine{\@currname}{%
mathtools is NOT loaded by zhlineskip\MessageBreak
Some of its features may not be available\MessageBreak
Leading in multi-line math will be stretched%
}%
\newcommand*\SetMathEnvironmentSinglespace[1]{%
\PackageError{zhlineskip}{%
Cannot use \string\SetMathEnvironmentSinglespace\space here%
}{%
Try loading zhlineskip with option\MessageBreak
\space\space`restoremathleading=true'%
}%
}
\newcommand*\RestoreMathEnvironmentLeading[1]{%
\PackageError{zhlineskip}{%
Cannot use \string\RestoreMathEnvironmentLeading\space here%
}{%
Try loading zhlineskip with option\MessageBreak
\space\space`restoremathleading=true'%
}%
}
\fi
\endinput
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
TeX/LaTeX
1
https://gitee.com/dataguru/nwafuthesis.git
git@gitee.com:dataguru/nwafuthesis.git
dataguru
nwafuthesis
nwafuthesis
master

搜索帮助