Skip to content

Commit

Permalink
use hyphen instead of en dash
Browse files Browse the repository at this point in the history
  • Loading branch information
zepinglee committed Apr 12, 2018
1 parent 04876fb commit 4ea7834
Show file tree
Hide file tree
Showing 5 changed files with 68 additions and 87 deletions.
19 changes: 6 additions & 13 deletions gbt7714-plain.bst
Original file line number Diff line number Diff line change
Expand Up @@ -574,22 +574,15 @@ FUNCTION {output.bibitem}
before.all 'output.state :=
}

FUNCTION {n.dashify}
FUNCTION {hyphenize}
{ 't :=
""
{ t empty$ not }
{ t #1 #1 substring$ "-" =
{ t #1 #2 substring$ "--" = not
{ "--" *
t #2 global.max$ substring$ 't :=
}
{ { t #1 #1 substring$ "-" = }
{ "-" *
t #2 global.max$ substring$ 't :=
}
while$
}
if$
{ "-" *
{ t #1 #1 substring$ "-" = }
{ t #2 global.max$ substring$ 't := }
while$
}
{ t #1 #1 substring$ *
t #2 global.max$ substring$ 't :=
Expand Down Expand Up @@ -935,7 +928,7 @@ FUNCTION {format.address.publisher}
FUNCTION {format.pages}
{ pages empty$
{ "" }
{ pages n.dashify }
{ pages hyphenize }
if$
}

Expand Down
19 changes: 6 additions & 13 deletions gbt7714-unsrt.bst
Original file line number Diff line number Diff line change
Expand Up @@ -574,22 +574,15 @@ FUNCTION {output.bibitem}
before.all 'output.state :=
}

FUNCTION {n.dashify}
FUNCTION {hyphenize}
{ 't :=
""
{ t empty$ not }
{ t #1 #1 substring$ "-" =
{ t #1 #2 substring$ "--" = not
{ "--" *
t #2 global.max$ substring$ 't :=
}
{ { t #1 #1 substring$ "-" = }
{ "-" *
t #2 global.max$ substring$ 't :=
}
while$
}
if$
{ "-" *
{ t #1 #1 substring$ "-" = }
{ t #2 global.max$ substring$ 't := }
while$
}
{ t #1 #1 substring$ *
t #2 global.max$ substring$ 't :=
Expand Down Expand Up @@ -935,7 +928,7 @@ FUNCTION {format.address.publisher}
FUNCTION {format.pages}
{ pages empty$
{ "" }
{ pages n.dashify }
{ pages hyphenize }
if$
}

Expand Down
27 changes: 12 additions & 15 deletions gbt7714.dtx
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ which was designed for use with the `natbib.sty' package.
%<package>\NeedsTeXFormat{LaTeX2e}[1999/12/01]
%<package>\ProvidesPackage{gbt7714}
%<*package>
[2018/03/16 v1.0.3 GB/T 7714-2015 BibTeX Style]
[2018/04/12 v1.0.4 GB/T 7714-2015 BibTeX Style]
%</package>
%
%<*driver>
Expand Down Expand Up @@ -170,6 +170,7 @@ which was designed for use with the `natbib.sty' package.
% \changes{v1.0.1}{2018/03/09}{著者出版年制的文献引用不再排序}
% \changes{v1.0.2}{2017/03/16}{正确识别姓名中的“others”}
% \changes{v1.0.3}{2018/03/29}{顺序编码制连续两个文献引用之间使用连接号}
% \changes{v1.0.4}{2018/04/12}{页码的连接号由 en dash 改为 hyphen}
%
%
% \section{简介}
Expand Down Expand Up @@ -463,6 +464,7 @@ which was designed for use with the `natbib.sty' package.
#1\NAT@@close\if*#3*\else\textsuperscript{#3}\fi\else#1\fi\endgroup}
% \end{macrocode}
%
% 顺序编码制连续两个文献引用之间使用连接号
% \begin{macrocode}
\patchcmd{\NAT@citexnum}{%
\ifx\NAT@last@yr\relax
Expand All @@ -471,7 +473,7 @@ which was designed for use with the `natbib.sty' package.
\def@NAT@last@yr{--\NAT@penalty}%
\fi
}{%
\def@NAT@last@yr{--\NAT@penalty}%
\def@NAT@last@yr{-\NAT@penalty}%
}{}{}
%</package>
% \end{macrocode}
Expand Down Expand Up @@ -1408,23 +1410,18 @@ FUNCTION {output.bibitem}
% END
% \end{pseudocode}
%
% 《规则》里页码范围的连接号使用 hyphen,需要将 dash 转为 hyphen。
%
% \begin{macrocode}
FUNCTION {n.dashify}
FUNCTION {hyphenize}
{ 't :=
""
{ t empty$ not }
{ t #1 #1 substring$ "-" =
{ t #1 #2 substring$ "--" = not
{ "--" *
t #2 global.max$ substring$ 't :=
}
{ { t #1 #1 substring$ "-" = }
{ "-" *
t #2 global.max$ substring$ 't :=
}
while$
}
if$
{ "-" *
{ t #1 #1 substring$ "-" = }
{ t #2 global.max$ substring$ 't := }
while$
}
{ t #1 #1 substring$ *
t #2 global.max$ substring$ 't :=
Expand Down Expand Up @@ -1862,7 +1859,7 @@ FUNCTION {format.address.publisher}
FUNCTION {format.pages}
{ pages empty$
{ "" }
{ pages n.dashify }
{ pages hyphenize }
if$
}
Expand Down
4 changes: 2 additions & 2 deletions gbt7714.sty
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
%%
\NeedsTeXFormat{LaTeX2e}[1999/12/01]
\ProvidesPackage{gbt7714}
[2018/03/16 v1.0.3 GB/T 7714-2015 BibTeX Style]
[2018/04/12 v1.0.4 GB/T 7714-2015 BibTeX Style]
\newif\if@gbt@numerical
\newif\if@gbt@super
\DeclareOption{super}{\@gbt@numericaltrue\@gbt@supertrue}
Expand Down Expand Up @@ -109,5 +109,5 @@
\def@NAT@last@yr{--\NAT@penalty}%
\fi
}{%
\def@NAT@last@yr{--\NAT@penalty}%
\def@NAT@last@yr{-\NAT@penalty}%
}{}{}
Loading

0 comments on commit 4ea7834

Please sign in to comment.