Skip to content

Commit

Permalink
feat: bibliolist (#93)
Browse files Browse the repository at this point in the history
  • Loading branch information
LogCreative authored Apr 21, 2022
1 parent 52842ab commit 905b2ed
Show file tree
Hide file tree
Showing 28 changed files with 280 additions and 131 deletions.
24 changes: 24 additions & 0 deletions .vscode/sjtubeamer.code-snippets

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion beamercolorthemesjtubeamer.sty

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion beamerfontthemesjtubeamer.sty

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

22 changes: 21 additions & 1 deletion beamerinnerthemesjtubeamer.sty

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion beamerouterthemesjtubeamer.sty

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion beamerthemesjtubeamer.sty

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion sjtucover.sty

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion sjtuvi.sty

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 5 additions & 0 deletions src/build.lua
Original file line number Diff line number Diff line change
Expand Up @@ -68,9 +68,14 @@ function compile_file(dir, cmd, filename)
local errorlevel = 0
errorlevel = run(dir, cmd .. " " .. filename)
if string.find(filename,"+") ~= nil then
if string.find(filename,"_") ~= nil then
errorlevel = bibtex(string.gsub(filename,".tex",""),dir)
errorlevel = run(dir,cmd .. " " .. filename)
end
if string.find(filename,"-") ~= nil then
-- biber after compiling the first time if it is marked as "-"
errorlevel = biber(string.gsub(filename,".tex",""),dir)
errorlevel = run(dir,cmd .. " " .. filename)
end
-- compile the second time if it is marked as "+"
errorlevel = run(dir,cmd .. " " .. filename)
Expand Down
33 changes: 23 additions & 10 deletions src/doc/sjtubeamer.tex
Original file line number Diff line number Diff line change
Expand Up @@ -384,7 +384,7 @@ \chapter{引用}

\section{Biber}

\faApple\ \faLinux\ 如果使用的是 \hologo{XeLaTeX} 编译,可以使用 \texttt{biblatex} 宏包,并采用 \textsc{Biber} 进行引用处理。
\faApple\ \faLinux\ 如果使用的是 \hologo{XeLaTeX} 编译,可以使用 \texttt{biblatex} 宏包,对于中文引用可以使用 \texttt{gb7714-2015} 样式,并采用 \textsc{Biber} 进行引用处理。

\beamerdemo[1]{step14+-.tex}

Expand All @@ -397,21 +397,34 @@ \section{Bib\TeX{}}

\faWindows 如果使用的是 \hologo{pdfLaTeX} 编译,需要使用 \texttt{gbt7714} 宏包,并采用老式的 \textsc{Bib\TeX{}} 进行引用处理。

\examplecode{bibtex.tex}
\beamerdemo[2]{step15+_.tex}

\begin{commentlist}
\item 对帧使用 \verb"allowframebreaks" 参数可以对过长的内容自动换页。
\end{commentlist}

\section{手动输入}

为了避免使用额外的文献数据库文件,可以手动输入文献列表。

\beamerdemo[1]{step16+-.tex}

\begin{commentlist}
\item \LaTeX{} 本身提供了 \texttt{thebibliography} 环境,环境的强制参数用于指定排版最长的标签(这里是两位数占位符),配套 \texttt{\textbackslash{}bibitem[标签]\{主键\}},在 \texttt{beamer} 中需要辅以 \texttt{\textbackslash{}newblock} 来分隔作者、文章标题、书目与其他内容。这里的主键可以在正文中引用。
\item\texttt{beamer} 中可以通过设定 \texttt{bibliography item} 模板为对应预设来更改图标,这里是 \texttt{text} 预设用于排印编号。也可以改为文章图标 \texttt{article},图书图标 \texttt{book} 或网络图标 \texttt{online} 等。
\item 为了与 \textsc{SJTUThesis} 兼容,引入 \texttt{bibliolist} 环境$^*$以避免使用 \texttt{\textbackslash{}bibitem} 命令,并添加对应的 \texttt{\textbackslash{}articleitem}, \texttt{\textbackslash{}bookitem}, \texttt{\textbackslash{}onlineitem} 用于切换不同的图标$^*$,并保持与 \texttt{\textbackslash{}bibitem} 相同的用法。
\item\texttt{bibliolist} 环境中也可以直接使用 \texttt{\textbackslash{}item} 以不使用 \texttt{\textbackslash{}newblock} 来分割条目中的不同部分,正如 \textsc{SJTUThesis} 所做的那样。但请不要与上一条中的图标命令混用。
\end{commentlist}

\chapter{图表}

表格与统计图是展示数据最直观的方式,可以采用内建的方式插入风格统一的矢量图表。\themename\ 对此设定了一些预设。

\section{表格}

考虑到许多专业数据是直接存储在逗号分隔符(\texttt{.csv})文件中的,便于数据内容的后续更改,用户可以采用 \texttt{pgfplotstable} 宏包从文件插入表格。
考虑到许多专业数据是直接存储在逗号分隔符(\texttt{.csv})文件中的,便于数据内容的后续更改,用户可以采用 \texttt{pgfplotstable} 宏包从文件插入表格(该宏包只支持英文表格)

\beamerdemo[1]{step15.tex}
\beamerdemo[1]{step17.tex}

\begin{commentlist}
\item 需要加载 \texttt{pgfplotstable} 宏包,表头变为主题色,采用三线表的样式。$^*$
Expand All @@ -422,7 +435,7 @@ \section{统计图}

如果希望通过统计图更加直观地展示数据,可以使用 \texttt{pgfplots} 宏包插入统计图。

\beamerdemo[1]{step16.tex}
\beamerdemo[1]{step18.tex}

\begin{commentlist}
\item 需要加载 \texttt{pgfplots} 宏包,必要时额外加载 \texttt{pgfplotstable} 宏包以读取文件数据。可以使用 \href{https://logcreative.github.io/PGFPlotsEdt/}{PGFPlots 统计绘图编辑器} 生成上述代码。
Expand All @@ -432,7 +445,7 @@ \section{缓存}

如果你需要使用较多的 Ti\emph{k}Z 和 \texttt{pgfplots} 插图,可以考虑启用图像缓存,当图像没有被更改时会采用上一次的编译产物。\themename\ 已经保护了一些不必要缓存的元素。

\beamerdemo[1]{step17.tex}
\beamerdemo[1]{step19.tex}

\begin{commentlist}
\item \themename\ 已经加载了 \verb"\usetikzlibrary{external}"。
Expand Down Expand Up @@ -464,7 +477,7 @@ \chapter{徽标}
\tcbitem[title={\textbackslash{}vlogo}] \resizebox{!}{4.8cm}{\vlogo\ }
\end{tcbitemize}

\beamerdemo[1]{step18.tex}
\beamerdemo[1]{step20.tex}

\begin{commentlist}
\item 使用 \texttt{\textbackslash{}logo} 设定徽标。在主题处使用 \verb"topright" 或 \verb"bottomright" 选项强制指定徽标的位置为右上角(\verb"max"默认)或左下角(\verb"maxplus" 和 \verb"min")。
Expand All @@ -475,7 +488,7 @@ \chapter{头图}

可以更改 \themename\ 封面中的头图。

\beamerdemo[1]{step19.tex}
\beamerdemo[1]{step21.tex}

\begin{commentlist}
\item 使用 \texttt{\textbackslash{}titlegraphic} 设定头图,需要在封面图输出前进行赋值。
Expand All @@ -487,7 +500,7 @@ \chapter{背景}

可以更改 \themename\ 的背景图。

\beamerdemo[1]{step20.tex}
\beamerdemo[1]{step22.tex}

\begin{commentlist}
\item \texttt{\textbackslash{}setbeamertemplate\{background\}\{\}} 可以设定背景图。如果设定为空,将会清除现在已经设定的背景图。请在主题加载完成后设定。
Expand All @@ -502,7 +515,7 @@ \section{样式}

上面的自定义配置可以全部写入一个样式文件中,以在加载主题后加载这个自定义样式文件。采用 \texttt{my} 选项可以从零开始打造这些配置。

\beamerdemo[1]{step21.tex}
\beamerdemo[1]{step23.tex}

其中 \verb"\usepackage{my}" 即加载了同级目录下的 \verb"my.sty" 自定样式文件。

Expand Down
2 changes: 1 addition & 1 deletion src/source/beamercolorthemesjtubeamer.dtx
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
% \iffalse
%<*package>
\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{beamercolorthemesjtubeamer}[2022/03/30 v2.6.0 sjtubeamer color theme]
\ProvidesPackage{beamercolorthemesjtubeamer}[2022/04/21 v2.6.1 sjtubeamer color theme]
%</package>
% \fi
% \CheckSum{0}
Expand Down
2 changes: 1 addition & 1 deletion src/source/beamerfontthemesjtubeamer.dtx
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
% \iffalse
%<*package>
\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{beamerfontthemesjtubeamer}[2022/03/30 v2.6.0 sjtubeamer font theme]
\ProvidesPackage{beamerfontthemesjtubeamer}[2022/04/21 v2.6.1 sjtubeamer font theme]
%</package>
% \fi
% \CheckSum{0}
Expand Down
70 changes: 69 additions & 1 deletion src/source/beamerinnerthemesjtubeamer.dtx
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
% \iffalse
%<*package>
\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{beamerinnerthemesjtubeamer}[2022/03/30 v2.6.0 sjtubeamer inner theme]
\ProvidesPackage{beamerinnerthemesjtubeamer}[2022/04/21 v2.6.1 sjtubeamer inner theme]
%</package>
% \fi
% \CheckSum{0}
Expand Down Expand Up @@ -288,6 +288,74 @@
\useinnertheme{circles}
% \end{macrocode}
%
% \begin{macro}{bibliolist}
% Create a bibliography list manually with \verb"\item" patched for \verb"\newblock".
% You can just use \verb"\item" without \verb"\newblock" command, or you could use \verb"\newblock" with \verb"\articleitem", \verb"\bookitem", \verb"\onlineitem".
% The mandantory parameter (usually \verb"00") indicates the widest label among items, if you want to indicate the item label seperately.
% \begin{macrocode}
\newenvironment{bibliolist}[1]{
% \end{macrocode}
% Patch the \verb"\item" command in this environment, to redefine \verb"\newblock" and assign \verb"\newblock" after this command. The style will behave like \verb"\bibitem" but without the mandantory parameter for bib key.
% \begin{macrocode}
\begin{thebibliography}{#1}
% \end{macrocode}
% Save the old definition for item.
% \begin{macrocode}
\let\olditem\item%
% \end{macrocode}
% Now define the item with new definition of \verb"\newblock" without interrupting the scan of next char for \verb"\item". Now, you could use \verb"\newblock" normally after \verb"\item" command with the initialized \verb"\newblock" state.
% This will not interrupt the definition of \verb"\bibitem" since the same definition on \verb"\newblock" has been made --- just define the thing the same time twice. Notice that the patch is NOT available for the regular \verb"thebibliography" command for compatibility reasons with other themes.
% \begin{macrocode}
\def\item{\def\newblock{\beamer@newblock}\olditem}
% \end{macrocode}
% User should insert items by \verb"\articleitem", \verb"\bookitem", \verb"\onlineitem" inside THIS environment, otherwise, the user should insert \verb"\newblock" after \verb"\item" manually, which breaks the use of \verb"\newblock" and not recommended with the only use of migration from \textsc{SJTUThesis} with the same style. Or not to use \verb"\newblock" for \verb"\item" at all.
% The commands like \verb"\articleitem" do not accept the optional parameter for a label since the first part of this command name has already indicates the label of this item. The command like \verb"\item" accepts the optional parameter for the label and will override the potential numeric numbering (you have to load \verb"biblatex" in the preamble or specify the \verb"bibliography item" beamer template to \verb"text" inside this environment) for this item without a bracket surrounding. The behavior is the same as \textsc{SJTUThesis}.
% The direct patch on \verb"\item" is hard since \verb"\bibitem" also depends on this command. As a matter of fact, the \verb"\item" itself cannot be cited and should not be numbered by the way otherwise user should use \verb"\bibitem" inside \verb"\thebibliography" environment directly.
% Set the beamer template of \verb"bibliography item" to \verb"text" locally to use the label of every item instead of the default icon outside the environment. This will also make the default behavior to make an bracket enumerate list.
% \begin{macrocode}
\setbeamertemplate{bibliography item}[text]
}{
\end{thebibliography}
}
% \end{macrocode}
% This environment syncs with \textsc{SJTUThesis}. It is used to generate the customized look of bibliography list without the processing from \textsc{Bib}\TeX{} or \verb"biblatex", which could bring performance improvement.
% You can specify the style of the icon by \verb"\setbeamertemplate{bibliography item}[book]" or other predefined template provided by \verb"beamer" class like \verb"online", \verb"triangle", \verb"text" (for square bracket enumeration).
% And such the setting should be done INSIDE the environment since \verb"beamer" will override the user setting on this template to text style at the begining of \verb"document" environment if it loads \verb"biblatex".
% \end{macro}
%
% \begin{macro}{\articleitem}
% Start a bibliography item with an article icon, it is recommended to use inside \verb"bibliolist" environment (or it will be not functional if the beamer template of \verb"bibliography item" is not \verb"text").
% Remember the newblock will be created after this item so you should use \verb"\newblock" to split different categories in the order of author, title, location and notes.
% \begin{macrocode}
\newcommand{\articleitem}{%
\item[{\setbeamertemplate{bibliography item}[article]\usebeamertemplate{bibliography item}}]%
\def\newblock{\beamer@newblock}\newblock%
}
% \end{macrocode}
% \end{macro}
%
% \begin{macro}{\bookitem}
% Start a bibliography item with an book icon, it is recommended to use inside \verb"bibliolist" environment (or it will be not functional if the beamer template of \verb"bibliography item" is not \verb"text").
% Remember the newblock will be created after this item so you should use \verb"\newblock" to split different categories in the order of author, title, location and notes.
% \begin{macrocode}
\newcommand{\bookitem}{%
\item[{\setbeamertemplate{bibliography item}[book]\usebeamertemplate{bibliography item}}]%
\def\newblock{\beamer@newblock}\newblock%
}
% \end{macrocode}
% \end{macro}
%
% \begin{macro}{\onlineitem}
% Start a bibliography item with an online icon, it is recommended to use inside \verb"bibliolist" environment (or it will be not functional if the beamer template of \verb"bibliography item" is not \verb"text").
% Remember the newblock will be created after this item so you should use \verb"\newblock" to split different categories in the order of author, title, location and notes.
% \begin{macrocode}
\newcommand{\onlineitem}{%
\item[{\setbeamertemplate{bibliography item}[online]\usebeamertemplate{bibliography item}}]%
\def\newblock{\beamer@newblock}\newblock%
}
% \end{macrocode}
% \end{macro}
%
% \subsubsection{Block Environments}
%
% The block in \verb"min" theme is not rounded.
Expand Down
2 changes: 1 addition & 1 deletion src/source/beamerouterthemesjtubeamer.dtx
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
% \iffalse
%<*package>
\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{beamerouterthemesjtubeamer}[2022/03/30 v2.6.0 sjtubeamer outer theme]
\ProvidesPackage{beamerouterthemesjtubeamer}[2022/04/21 v2.6.1 sjtubeamer outer theme]
%</package>
% \fi
% \CheckSum{0}
Expand Down
2 changes: 1 addition & 1 deletion src/source/beamerthemesjtubeamer.dtx
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
% ------------------------------------------------------------------- \fi
% \iffalse
\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{beamerthemesjtubeamer}[2022/03/30 v2.6.0 sjtubeamer parent theme]
\ProvidesPackage{beamerthemesjtubeamer}[2022/04/21 v2.6.1 sjtubeamer parent theme]
% \fi
%
% \subsection{Parent Theme}
Expand Down
2 changes: 1 addition & 1 deletion src/source/sjtucover.dtx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
% \iffalse
%<*package>
\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{sjtucover}[2022/03/30 v2.6.0 cover library for sjtubeamer]
\ProvidesPackage{sjtucover}[2022/04/21 v2.6.1 cover library for sjtubeamer]
%</package>
% \fi
% \CheckSum{0}
Expand Down
Loading

0 comments on commit 905b2ed

Please sign in to comment.