Skip to content

Commit

Permalink
Updated format (font and color) of outline headings.
Browse files Browse the repository at this point in the history
  • Loading branch information
fredqi committed Sep 5, 2016
1 parent b6648b1 commit a52653a
Show file tree
Hide file tree
Showing 2 changed files with 54 additions and 32 deletions.
20 changes: 17 additions & 3 deletions examples/my-nsfc-proposal.tex
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
%% Author: Fred Qi
%% Created: 2016-02-04 15:26:58(-0700)
%%
%% Last-Updated: 2016-07-11 18:33:23(+0800) [by Fred Qi]
%% Update #: 71
%% Last-Updated: 2016-09-05 16:49:58(+0800) [by Fred Qi]
%% Update #: 73
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%
%%% Commentary:
Expand All @@ -18,7 +18,7 @@
%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\documentclass[subfig]{mynsfc}
\documentclass[subfig,boldtoc]{mynsfc}

\bibliography{IEEEabrv,my-nsfc-proposal}

Expand Down Expand Up @@ -122,6 +122,20 @@ \section{工作基础}
\texttt{initauthors} 中的哈希字符串可以在Biber/bibtex 生成的文件
\texttt{*.bbl} 中找到。

需要强调的作者列表有两种形式,分别适用于不同版本的\texttt{biblatex}。
\begin{description}
\item[3.3+ (20160301)] 由于姓名处理的宏更新,请使用哈希字符串列表指定需要强调
的作者。
\begin{verbatim}
\initauthors{{72b3cccfc646adeb1d6b20320b56fd7d}}
\end{verbatim}
\item[3.2- (20151228)] 使用旧式的姓名处理宏,使用下列形式的作者列表。
\begin{verbatim}
\forcsvlist{\listadd\boldnames}{{Qi, F\bibinitperiod}}
\end{verbatim}
\end{description}


% \forcsvlist{\listadd\boldnames}{{Qi, F\bibinitperiod}}
\initauthors{{72b3cccfc646adeb1d6b20320b56fd7d}}
\printbibliography[prefixnumbers=J,heading=cvtype,title={相关工作}]
Expand Down
66 changes: 37 additions & 29 deletions mynsfc.dtx
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ Running "make install" installs the files in the local TeX tree.
%<class>\NeedsTeXFormat{LaTeX2e}[1999/12/01]
%<class>\ProvidesClass{mynsfc}
%<*class>
[2016/07/11 v1.01 A LaTeX class for writing NSFC proposals.]
[2016/09/05 v1.01 A XeLaTeX class for writing NSFC proposals.]
%</class>
%<*driver>
\documentclass{ltxdoc}
Expand Down Expand Up @@ -121,12 +121,18 @@ Running "make install" installs the files in the local TeX tree.
% \filedate.} } \author{Fred Qi\thanks{E-mail: [email protected]}} \date{
% \filedate 发布}
%
%\maketitle
% \maketitle
%
%\changes{v1.00}{2015/08/18}{First public release}
%\changes{v1.01}{2016/07/11}{Revised command maketitle}
%\changes{v1.01}{2016/07/11}{Added an option arabicpart}
%\changes{v1.01}{2016/07/11}{Author highlight with latest biblatex}
% \changes{v1.00}{2015/08/18}{First public release}
% \changes{v1.01}{2016/07/11}{Improved command \texttt{maketitle}}
% \changes{v1.01}{2016/07/11}{Added an option \texttt{arabicpart}}
% \changes{v1.01}{2016/07/11}{Author highlight with \texttt{biblatex} newer than
% 3.3 (2016-03-01)}
% \changes{v1.01}{2016/09/05}{Added options \texttt{tocfont} and
% \texttt{boldtoc} to select font on headings}
% \changes{v1.01}{2016/09/05}{Using kvoptions to handle package options}
% \changes{v1.01}{2016/09/05}{Added an option \texttt{toccolor} to show outline
% in a given color specified by a HTML/CSS style hex code}
%
% \begin{abstract}
% 用于自然基金申请书正文部分的撰写。
Expand All @@ -145,13 +151,16 @@ Running "make install" installs the files in the local TeX tree.
%
%<*class>
% \begin{macrocode}
%% Options
\newif\ifmynsfc@subfig\mynsfc@subfigfalse
\newif\ifmynsfc@arabicpart\mynsfc@arabicpartfalse
\DeclareOption{subfig}{\mynsfc@subfigtrue}
\DeclareOption{arabicpart}{\mynsfc@arabicparttrue}
\ExecuteOptions{}
\ProcessOptions
\ProcessOptions*
%% Options
\RequirePackage{kvoptions}
\DeclareBoolOption[false]{subfig}
\DeclareBoolOption[false]{arabicpart}
\DeclareBoolOption[false]{boldtoc}
\DeclareStringOption[kai]{tocfont}
\DeclareStringOption[0070c0]{toccolor}
\ProcessKeyvalOptions*
%% Load default class
\LoadClass[a4paper,fleqn]{article}
% \end{macrocode}
Expand Down Expand Up @@ -238,16 +247,6 @@ Running "make install" installs the files in the local TeX tree.
}
% \end{macrocode}
%
% \begin{macro}{\dummyMacro}
% This is a dummy macro. If it did anything, we'd describe its
% implementation here.
% \begin{macrocode}
% \begin{macrocode}
%
\newcommand{\dummyMacro}{}
% \end{macrocode}
% \end{macro}
%
% \begin{macrocode}
%% Setup Chinese fonts with xeCJK
\RequirePackage[AutoFakeBold]{xeCJK}
Expand Down Expand Up @@ -286,6 +285,15 @@ Running "make install" installs the files in the local TeX tree.
% \end{macro}
% \end{macro}
%
% \begin{macro}{\tocformat}
% \begin{macrocode}
\ifmynsfc@boldtoc
\newcommand{\tocformat}{\CJKfamily{\mynsfc@tocfont}\color[HTML]{\mynsfc@toccolor}\bfseries}
\else
\newcommand{\tocformat}{\CJKfamily{\mynsfc@tocfont}\color[HTML]{\mynsfc@toccolor}}
\fi
% \end{macrocode}
% \end{macro}
% \begin{macrocode}
\newlength\mynsfc@linespace
\newcommand{\mynsfc@choosefont}[2]{%
Expand Down Expand Up @@ -356,7 +364,7 @@ Running "make install" installs the files in the local TeX tree.
% \begin{environment}{hcomment}
% Dimmed text used as hint after section titles.
% \begin{macrocode}
\newenvironment{hcomment}{\vskip-3pt\color{gray}}{\vskip6pt}
\newenvironment{hcomment}{\vskip-3pt\color[HTML]{\mynsfc@toccolor}}{\vskip6pt}
% \end{macrocode}
% \end{environment}
%
Expand Down Expand Up @@ -400,7 +408,7 @@ Running "make install" installs the files in the local TeX tree.
% \begin{macro}{\maketitle}
\renewcommand{\maketitle}{%
\begin{center}%
\heiti\erhao\@title%
\tocformat\erhao\@title%
\end{center}}
% \end{macro}
%
Expand All @@ -413,7 +421,7 @@ Running "make install" installs the files in the local TeX tree.
% \begin{macrocode}
\ifmynsfc@arabicpart%
\renewcommand{\thepart}{\arabic{part}.}
\titleformat{\part}{\heiti\sanhao}{\thepart}{1ex}{}
\titleformat{\part}{\tocformat\sanhao}{\thepart}{1ex}{}
\renewcommand{\thesection}{\arabic{section})}
\renewcommand{\thesubsection}{\Alph{subsection})}
\else%
Expand All @@ -423,21 +431,21 @@ Running "make install" installs the files in the local TeX tree.
{十一}\or{十二}\or{十三}\or{十四}\or{十五}\or%
{十六}\or{十七}\or{十八}\or{十九}\or{二十}\fi}
\renewcommand{\thepart}{(\nsfc@CJKnumber{\c@part})}
\titleformat{\part}{\heiti\sanhao}{\thepart}{0ex}{}
\titleformat{\part}{\tocformat\sanhao}{\thepart}{0ex}{}
\renewcommand{\thesection}{\arabic{section}.}
\renewcommand{\thesubsection}{\arabic{section}.\arabic{subsection}}
\fi

\titlespacing{\part}{0ex}{4ex}{2ex}

\@addtoreset{section}{part}
\titleformat{\section}{\heiti\xiaosan}{\thesection}{0.25em}{}
\titleformat{\section}{\tocformat\xiaosan}{\thesection}{0.25em}{}
\titlespacing{\section}{0em}{4ex}{2ex}

\titleformat{\subsection}{\hei\sihao}{\thesubsection}{0.25em}{}
\titleformat{\subsection}{\tocformat\sihao}{\thesubsection}{0.25em}{}
\titlespacing{\subsection}{0em}{2ex}{1ex}

\titleformat{\subsubsection}{\heiti\banxiaosi}{\thesubsubsection}{0.25em}{}
\titleformat{\subsubsection}{\tocformat\banxiaosi}{\thesubsubsection}{0.25em}{}
\titlespacing{\subsubsection}{0em}{2ex}{1ex}
% \end{macrocode}
% \end{macro}
Expand Down

0 comments on commit a52653a

Please sign in to comment.