Skip to content

Commit 04f6b5c

Browse files
author
liwentian
committed
fd
1 parent e7de9e5 commit 04f6b5c

4 files changed

Lines changed: 258 additions & 0 deletions

File tree

‎ebook/string/String.tex‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
\chapter{String}

‎ebook/string/format.cls‎

Lines changed: 101 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,101 @@
1+
\usepackage[centering,paperwidth=180mm,paperheight=230mm,%
2+
body={480pt,580pt},marginparsep=10pt,marginpar=50pt]{geometry}
3+
\usepackage{color}
4+
\usepackage{enumitem}
5+
\usepackage{fancyvrb}
6+
\usepackage[bottom,perpage,symbol*]{footmisc}
7+
\usepackage{graphicx}
8+
\usepackage[hidelinks]{hyperref}
9+
\usepackage{makeidx}
10+
\usepackage[toc]{multitoc}
11+
\usepackage{pifont}
12+
\usepackage{underscore}
13+
\usepackage{amsmath}
14+
15+
\DefineFNsymbols*{chinese}{{\ding{172}}{\ding{173}}{\ding{174}}{\ding{175}}%
16+
{\ding{176}}{\ding{177}}{\ding{178}}{\ding{179}}{\ding{180}}{\ding{181}}}
17+
\setfnsymbol{chinese}
18+
19+
\hypersetup{bookmarksnumbered=true,bookmarksdepth=2}
20+
21+
\CTEXsetup[number={\thechapter}]{chapter}
22+
\CTEXsetup[format+={\raggedleft}]{chapter}
23+
\CTEXsetup[beforeskip={10pt}]{chapter}
24+
\CTEXsetup[afterskip={30pt}]{chapter}
25+
\def\CTEX@chapter@aftername{\par} % \CTEXsetup[aftername={\par}]{chapter}
26+
\CTEXsetup[format+={\raggedright}]{section}
27+
\CTEXsetup[beforeskip={-3.0ex plus -1ex minus -.2ex}]{section}
28+
\CTEXsetup[afterskip={2.3ex plus .2ex minus 0.2ex}]{section}
29+
30+
\renewcommand \thefigure{\thechapter-\arabic{figure}}
31+
\renewcommand \thetable{\thechapter-\arabic{table}}
32+
33+
\newcommand\figcaption[1]{\def\@captype{figure}\caption{#1}}
34+
\newcommand\tabcaption[1]{\def\@captype{table}\caption{#1}}
35+
36+
\long\def\@caption#1[#2]#3{%
37+
\addcontentsline{\csname ext@#1\endcsname}{#1}%
38+
{\protect\numberline{\csname fnum@#1\endcsname}{ \ignorespaces #2}}% change "the" to "fnum@"
39+
\normalsize
40+
\@makecaption{\csname fnum@#1\endcsname}{\ignorespaces #3}}
41+
42+
\long\def\@makecaption#1#2{%
43+
\vskip\abovecaptionskip
44+
\sbox\@tempboxa{#1\quad#2}%
45+
\ifdim \wd\@tempboxa >\hsize
46+
#1\quad#2\par
47+
\else
48+
\global \@minipagefalse
49+
\hb@xt@\hsize{\hfil\box\@tempboxa\hfil}%
50+
\fi
51+
\vskip\belowcaptionskip}
52+
53+
\setlength\abovecaptionskip{0pt}
54+
55+
\setmainfont{Times New Roman}
56+
%\setmainfont{Linux Libertine}
57+
%\setmainfont{TeX Gyre Pagella}
58+
\newfontfamily\urlfont{PT Sans Narrow}
59+
%\setmonofont[AutoFakeBold=1.6,AutoFakeSlant=0.17,Mapping=tex-text-tt]{Inconsolata}
60+
\setCJKfamilyfont{zhyou}{YouYuan}
61+
62+
\newcommand{\fn}[1]{\texttt{#1}}
63+
\newcommand{\sfn}[1]{\texttt{\small #1}}
64+
\newcommand{\kw}[1]{\textsf{#1}}
65+
\newcommand{\myurl}[1]{{\urlfont #1}}
66+
\newcommand{\mpar}[1]{\marginpar[\hfill\kaishu #1]{\kaishu #1}}
67+
\newcommand{\mn}[1]{\texttt{\bs #1}}
68+
\renewcommand{\today}{\the\year-\the\month-\the\day}
69+
\newcommand\bs{\textbackslash}
70+
\newcommand{\code}[1]{\small{\fontspec{Latin Modern Mono} #1}}
71+
72+
\newcommand\begindot{\begin{itemize}
73+
[itemsep=2pt plus 2pt minus 2pt,%
74+
topsep=3pt plus 2pt minus 2pt,%
75+
parsep=0pt plus 2pt minus 2pt]}
76+
\newcommand\myenddot{\end{itemize}}
77+
78+
\newcommand\beginnum{\begin{enumerate}
79+
[itemsep=2pt plus 2pt minus 2pt,%
80+
topsep=3pt plus 2pt minus 2pt,%
81+
parsep=0pt plus 2pt minus 2pt]}
82+
\newcommand\myendnum{\end{enumerate}}
83+
84+
\DefineVerbatimEnvironment%
85+
{Code}{Verbatim}
86+
{fontsize=\small,baselinestretch=0.9,xleftmargin=3mm}
87+
88+
\raggedbottom
89+
%\setlength{\parskip}{1ex plus .5ex minus .5ex}
90+
91+
\input{verbatim.cls}
92+
\DefineVerbatimEnvironment%
93+
{Codex}{Verbatim}
94+
{fontsize=\small,baselinestretch=0.9,xleftmargin=3mm,%
95+
frame=lines,labelposition=all,framesep=5pt}
96+
97+
\DefineVerbatimEnvironment%
98+
{Code}{Verbatim}
99+
{fontsize=\small,baselinestretch=0.9,xleftmargin=3mm}
100+
101+
\makeindex

‎ebook/string/leetcode-string.tex‎

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
\documentclass[10pt,adobefonts,fancyhdr,hyperref,UTF8]{ctexbook}
2+
3+
\usepackage{multirow}
4+
% for \soul 删除线
5+
\usepackage{ulem}
6+
% 表头斜线
7+
\usepackage{diagbox}
8+
9+
\makeatletter
10+
\input{format.cls}
11+
\makeatother
12+
13+
14+
15+
\begin{document}
16+
\sloppy
17+
\newcommand\BookTitle{LeetCode题解}
18+
\pagestyle{fancy}
19+
\fancyhf{}
20+
\fancyhead[RE]{\normalfont\small\rmfamily\nouppercase{\leftmark}}
21+
\fancyhead[LO]{\normalfont\small\rmfamily\nouppercase{\rightmark}}
22+
\fancyhead[LE,RO]{\thepage}
23+
%\fancyfoot[LE,LO]{\small\normalfont\youyuan\BookTitle}
24+
25+
\makeatletter
26+
\@openrightfalse
27+
\makeatother
28+
29+
\frontmatter % 开始前言目录,页码用罗马数字
30+
31+
\include{title}
32+
33+
\tableofcontents
34+
35+
\mainmatter % 开始正文,页码用阿拉伯数字
36+
37+
\graphicspath{{images/}}
38+
39+
\include{String}
40+
41+
\appendix % 开始附录,章用字母编号
42+
\printindex
43+
44+
\end{document}

‎ebook/string/verbatim.cls‎

Lines changed: 112 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,112 @@
1+
\def\FV@SetLineWidth{%
2+
\if@FV@ResetMargins\else
3+
\advance\leftmargin\@totalleftmargin
4+
\fi
5+
\advance\leftmargin\FV@XLeftMargin\relax
6+
\advance\rightmargin\FV@XRightMargin\relax
7+
\linewidth\hsize
8+
%\advance\linewidth-\leftmargin
9+
%\advance\linewidth-\rightmargin
10+
\hfuzz\FancyVerbHFuzz\relax}
11+
12+
13+
\def\FV@SingleFrameLine#1{%
14+
%% DG/SR modification end
15+
\hbox to\z@{%
16+
%\kern\leftmargin
17+
%% DG/SR modification begin - Jun. 22, 1998
18+
\ifnum#1=\z@
19+
\let\FV@Label\FV@LabelBegin
20+
\else
21+
\let\FV@Label\FV@LabelEnd
22+
\fi
23+
\ifx\FV@Label\relax
24+
%% DG/SR modification end
25+
\FancyVerbRuleColor{\vrule \@width\linewidth \@height\FV@FrameRule}%
26+
%% DG/SR modification begin - Jun. 22, 1998
27+
\else
28+
\ifnum#1=\z@
29+
\setbox\z@\hbox{\strut\enspace\urlfont\FV@LabelBegin\strut}%
30+
\else
31+
\setbox\z@\hbox{\strut\enspace\urlfont\FV@LabelEnd\strut}%
32+
\fi
33+
\@tempdimb=\dp\z@
34+
\advance\@tempdimb -.5\ht\z@
35+
\@tempdimc=\linewidth
36+
\advance\@tempdimc -\wd\z@
37+
%\divide\@tempdimc\tw@
38+
\ifnum#1=\z@ % Top line
39+
\ifx\FV@LabelPositionTopLine\relax
40+
\FancyVerbRuleColor{\vrule \@width\linewidth \@height\FV@FrameRule}%
41+
\else
42+
\FV@FrameLineWithLabel
43+
\fi
44+
\else % Bottom line
45+
\ifx\FV@LabelPositionBottomLine\relax
46+
\FancyVerbRuleColor{\vrule \@width\linewidth \@height\FV@FrameRule}%
47+
\else
48+
\FV@FrameLineWithLabel
49+
\fi
50+
\fi
51+
\fi
52+
%% DG/SR modification end
53+
\hss}}
54+
55+
56+
%% DG/SR modification begin - May. 19, 1998
57+
\def\FV@FrameLineWithLabel{%
58+
\ht\z@\@tempdimb\dp\z@\@tempdimb%
59+
\FancyVerbRuleColor{%
60+
\raise 0.5ex\hbox{\vrule \@width\@tempdimc \@height\FV@FrameRule}%
61+
\raise\@tempdimb\box\z@}}
62+
%% DG/SR modification end
63+
64+
65+
\def\FV@EndListFrame@Lines{%
66+
\begingroup
67+
%\vskip 0.5ex
68+
\baselineskip\z@skip
69+
\kern\FV@FrameSep\relax
70+
%% DG/SR modification begin - May. 19, 1998
71+
%% \FV@SingleFrameLine
72+
\FV@SingleFrameLine{\@ne}%
73+
%% DG/SR modification end
74+
\endgroup}
75+
76+
\newskip\mytopsep
77+
\setlength{\mytopsep}{4pt plus 2pt minus 3pt}
78+
79+
\def\FV@ListVSpace{%
80+
\@topsepadd\mytopsep
81+
\if@noparlist\advance\@topsepadd\partopsep\fi
82+
\if@inlabel
83+
\vskip\parskip
84+
\else
85+
\if@nobreak
86+
\vskip\parskip
87+
\clubpenalty\@M
88+
\else
89+
\addpenalty\@beginparpenalty
90+
\@topsep\@topsepadd
91+
\advance\@topsep\parskip
92+
\addvspace\@topsep
93+
\fi
94+
\fi
95+
%\showthe \@topsepadd
96+
%\showthe \topsep
97+
%\showthe \partopsep
98+
%\showthe \parskip
99+
\global\@nobreakfalse
100+
\global\@inlabelfalse
101+
\global\@minipagefalse
102+
\global\@newlistfalse}
103+
104+
\def\FV@EndList{%
105+
\FV@ListProcessLastLine
106+
\FV@EndListFrame
107+
%\showthe \@topsepadd
108+
\@endparenv
109+
\endgroup
110+
\@endpetrue}
111+
112+
\def\theFancyVerbLine{\sffamily\scriptsize\arabic{FancyVerbLine}}

0 commit comments

Comments
 (0)