-
Notifications
You must be signed in to change notification settings - Fork 22
/
ttools.sty
78 lines (70 loc) · 1.67 KB
/
ttools.sty
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
%!TEX TS-program = xelatex
% vim: set fenc=utf-8
% -*- coding: UTF-8; -*-
%!TEX encoding = UTF-8 Unicode
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% FileName: ttools.sty
%% Author: Timozer
%% E-mail: [email protected]
%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\NeedsTeXFormat{LaTeX2e}[1994/06/01]
\ProvidesPackage{ttools}[2018/03/16 Some Useful Tools]
\RequirePackage{etoolbox}
\RequirePackage{xcolor}
\RequirePackage{float}
\NewDocumentCommand{\tilcode}{m}{\colorbox{lightgray!50}{\ttfamily\small #1}}
\NewDocumentCommand{\cmd}{m}{\texttt{\small $\backslash$#1}}
\NewDocumentCommand{\email}{m}{\texttt{\small $\backslash$#1}}
\NewDocumentEnvironment{ttab}{m m}{%
\begin{table}[htbp]
\centering
\caption{#1}
\label{#2}
}{%
\end{table}
}
\NewDocumentEnvironment{Ttab}{m m}{%
\begin{table}[H]
\centering
\caption{#1}
\label{#2}
}{%
\end{table}
}
\NewDocumentEnvironment{tfig}{m m}{%
\begin{figure}[htbp]
\centering
}{%
\caption{#1}
\label{#2}
\end{figure}
}
\NewDocumentEnvironment{Tfig}{m m}{%
\begin{figure}[H]
\centering
}{%
\caption{#1}
\label{#2}
\end{figure}
}
% for poems
\NewDocumentEnvironment{tpoem}{m m}{%
\vskip.8ex
\begin{center}
\begin{minipage}{.65\textwidth}
\small \sffamily
}{%
\rightline{------~#1《~#2~》}
\end{minipage}
\end{center}
\vskip.7ex
}
\makeatletter
\def\tagform@#1{\maketag@@@{(\ignorespaces#1\@@italiccorr)}}
\makeatother
\AtBeginDocument{%
\let\oldref\ref%
\renewcommand{\ref}[1]{\hskip0.25em\oldref{#1}\hskip0.25em}
}
\endinput