-
Notifications
You must be signed in to change notification settings - Fork 0
/
mymacros.sty
87 lines (76 loc) · 2.77 KB
/
mymacros.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
79
80
81
82
83
84
85
86
87
%% -*- coding: utf-8-unix -*-
% program list
% ref: http://www.biwako.shiga-u.ac.jp/sensei/kumazawa/tex/listings.html
% ref: http://d.hatena.ne.jp/Kshi_Kshi/20110219/1298117610
% ref: http://qiita.com/ayihis@github/items/c779e4ab5cd7580f1f87
\usepackage{listings,jlisting}
\usepackage{lstlinebgrd}
\lstset{
breaklines=true,
language=Ruby,
basicstyle=\ttfamily,
lineskip=-0.3zw,
columns=[1]{fullflexible},
keepspaces=true,
commentstyle={\ttfamily \color[cmyk]{1,0.4,1,0}},
classoffset=1,
keywordstyle={\bfseries \color[cmyk]{0,1,0,0}},
stringstyle={\ttfamily \color[rgb]{0,0,1}},
% frame=single,
frameshape={RYRNNNNN}{nny}{ynn}{RYRNNNNN}, % rounded corner frame
framesep=5pt,
rulecolor=\color{gray!90},
showstringspaces=false,
numbers=left,
numberstyle=\ttfamily,
stepnumber=1,
tabsize=2,
}
% change caption
\renewcommand{\lstlistingname}{リスト}
% for colored text box
\usepackage{tikz}
\usepackage[framemethod=tikz]{mdframed}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% Macro definitions
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% ref: http://www.opt.mist.i.u-tokyo.ac.jp/~tasuku/tikz.html
% \newcommand{\code}[1]{\tikz[baseline=(x.base)]{\node(x)[rectangle, fill=gray!10, rounded corners]{\texttt{#1}}}}
\newcommand{\code}[1]{\texttt{#1}} % alias texttt
% 本当はverbatimをくみあわせたいが、
% newenvironment 内で verbatim を使うことはできないようなので、
% 本文中で併用すること。
\newenvironment{textbox} {
\begin{mdframed}[roundcorner=0.3zw,
skipabove=1zw, skipbelow=1zw,
innertopmargin=1zw, innerbottommargin=1zw,
innerleftmargin=0.8zw, innerrightmargin=0.8zw,
linecolor=gray!10, linewidth=0.1zw, backgroundcolor=gray!10]
}{
\end{mdframed}
}
%% table/figure number format
%% http://www.biwako.shiga-u.ac.jp/sensei/kumazawa/tex/011.html
\renewcommand{\thetable}{\thechapter.\arabic{table}}
\@addtoreset{table}{chapter}
\renewcommand{\thefigure}{\thechapter.\arabic{figure}}
\@addtoreset{figure}{chapter}
%% reference
\newcommand{\figref}[1]{図~\ref{#1}}
\newcommand{\tabref}[1]{表~\ref{#1}}
\newcommand{\lstref}[1]{リスト~\ref{#1}}
% citation alias (macro)
\newcommand{\lopj}{L1patchプロジェクト} % wo/cite
\newcommand{\lopjc}{L1patchプロジェクト~\cite{ool-l1pj-web}} % w/cite
\newcommand{\lopjpoc}{\lopj 活動報告書~\cite{l1pjpoc}}
\newcommand{\lopjtech}{\lopj 技術情報~\cite{l1pjtech}}
\newcommand{\nettester}{NetTester~\cite{nettester}}
\newcommand{\nettesterex}{NetTester Examples~\cite{nettester-ex}}
\newcommand{\yo}{ヨーヨーダイン社}
\newcommand{\tj}{タジマックス社}
% QA: listingsパッケージのtitleオプションについて
% http://oku.edu.mie-u.ac.jp/tex/mod/forum/discuss.php?d=1543
% \begin{document} の直前におく
\makeatletter
\def\lst@title@dropdelim\hskip1zw{}
\makeatother