diff --git a/build.lua b/build.lua index 8a39970b..c768de54 100644 --- a/build.lua +++ b/build.lua @@ -11,8 +11,8 @@ docfiles = { "thusetup.tex", "data", "ref", } -installfiles = {"*.cls", "*.bst", "*.bbx", "*.cbx", "tsinghua-name-bachelor.pdf"} -sourcefiles = {"*.dtx", "*.ins", "*.bst", "*.bbx", "*.cbx", "tsinghua-name-bachelor.pdf"} +installfiles = {"*.cls", "*.bst", "*.bbx", "*.cbx", "*.csl", "tsinghua-name-bachelor.pdf"} +sourcefiles = {"*.dtx", "*.ins", "*.bst", "*.bbx", "*.cbx", "*.csl", "tsinghua-name-bachelor.pdf"} tagfiles = {"*.dtx", "CHANGELOG.md", "package.json"} textfiles = {"*.md","LICENSE"} typesetdemofiles = {"thuthesis-example.tex", "spine.tex"} diff --git a/latexmkrc b/latexmkrc index 848fd131..f8c8ff7b 100644 --- a/latexmkrc +++ b/latexmkrc @@ -6,6 +6,8 @@ $xelatex = "xelatex -shell-escape -file-line-error -halt-on-error -interaction=n $lualatex = "lualatex -shell-escape -file-line-error -halt-on-error -interaction=nonstopmode -synctex=1 %O %S"; $xdvipdfmx = "xdvipdfmx -q -E -o %D %O %S"; +$bibtex = "citeproc-lua %S"; + $bibtex_use = 1.5; $clean_ext = "hd loe ptc run.xml synctex.gz thm xdv"; diff --git a/thusetup.tex b/thusetup.tex index 6a21d8c1..5ca6b493 100644 --- a/thusetup.tex +++ b/thusetup.tex @@ -160,9 +160,22 @@ % \usepackage[style=thuthesis-author-year]{biblatex} % \usepackage[style=apa]{biblatex} % \usepackage[style=mla-new]{biblatex} +% \usepackage[notes,backend=biber]{biblatex-chicago} % 声明 BibLaTeX 的数据库 % \addbibresource{ref/refs.bib} +% 参考文献使用 citation-style-language 宏包(试验性) +% 需要 TeX Live 2023+ 以及最新版 citation-style-language 宏包 +% \usepackage{citation-style-language} +% \cslsetup{style = thuthesis-numeric} +% \cslsetup{style = thuthesis-author-year} +% \cslsetup{style = apa} +% \cslsetup{style = modern-language-association} +% \cslsetup{style = cell} % 生物医学 +% \cslsetup{style = tsinghua-university-academy-of-arts-and-design} % 美术学院 +% 声明 CSL 的数据库 +% \addbibresource{ref/refs.bib} + % 定义所有的图片文件在 figures 子目录下 \graphicspath{{figures/}} diff --git a/thuthesis-author-year.csl b/thuthesis-author-year.csl new file mode 100644 index 00000000..3aa42c51 --- /dev/null +++ b/thuthesis-author-year.csl @@ -0,0 +1,483 @@ + + diff --git a/thuthesis-example.tex b/thuthesis-example.tex index 8c3061a0..526cb84a 100644 --- a/thuthesis-example.tex +++ b/thuthesis-example.tex @@ -60,8 +60,8 @@ \backmatter % 参考文献 -\bibliography{ref/refs} % 参考文献使用 BibTeX 编译 -% \printbibliography % 参考文献使用 BibLaTeX 编译 +\bibliography{ref/refs} % 参考文献使用 BibTeX +% \printbibliography % 参考文献使用 BibLaTeX 或 citation-style-language % 附录 % 本科生需要将附录放到声明之后,个人简历之前 diff --git a/thuthesis-numeric.csl b/thuthesis-numeric.csl new file mode 100644 index 00000000..12f64d9f --- /dev/null +++ b/thuthesis-numeric.csl @@ -0,0 +1,442 @@ + + diff --git a/thuthesis.dtx b/thuthesis.dtx index 8ad13c0e..8aaaba5c 100644 --- a/thuthesis.dtx +++ b/thuthesis.dtx @@ -1795,7 +1795,9 @@ \AtEndPreamble{ \@ifpackageloaded{biblatex}{}{ \@ifpackageloaded{apacite}{}{ - \RequirePackage{natbib} + \@ifpackageloaded{citation-style-language}{}{ + \RequirePackage{natbib} + } } } } @@ -5909,6 +5911,42 @@ } % \end{macrocode} % +% \subsubsection{\pkg{citation-style-language} 宏包} +% +% \begin{macrocode} +\AtEndOfPackageFile*{citation-style-language}{ + \AtBeginDocument{ + \ifthenelse{\equal{\csl@style}{apa}}{\def\bibname{REFERENCES}}{} + \ifthenelse{\equal{\csl@style}{modern-language-association}}{\def\bibname{WORKS CITED}}{} + } + \renewcommand\bibsection{\thu@chapter*{\bibname}} + \newcommand\thu@set@bibliography@format{% + \ifthu@degree@bachelor + \cslsetup{ + bib-font = \fontsize{10.5bp}{17bp}\selectfont, + bib-item-sep = 3bp \@plus 3bp \@minus 3bp, + }% + \ifthu@main@language@chinese + \cslsetup{bib-hang = 21bp}% + \else + \cslsetup{bib-hang = 0.5in}% + \fi + \else + \cslsetup{ + bib-font = \fontsize{10.5bp}{16bp}\selectfont, + bib-item-sep = 3bp \@plus 3bp \@minus 3bp, + bib-entry-page-break = false, + % bib-label-sep = 0.1cm, % TODO + bib-hang = 21bp, + }% + \fi + } + \thu@set@bibliography@format + \thu@option@hook{degree}{\thu@set@bibliography@format} + \thu@option@hook{main-language}{\thu@set@bibliography@format} +} +% \end{macrocode} +% % \subsubsection{\pkg{apacite} 宏包} % % \pkg{apacite} 在 \cs{begindocument} 处载入的 \file{english.apc} diff --git a/tsinghua-university-academy-of-arts-and-design.csl b/tsinghua-university-academy-of-arts-and-design.csl new file mode 100644 index 00000000..9bf8692b --- /dev/null +++ b/tsinghua-university-academy-of-arts-and-design.csl @@ -0,0 +1,211 @@ + +