diff --git a/.vscode/sjtubeamer.code-snippets b/.vscode/sjtubeamer.code-snippets index cdc61147..5a8e6cf5 100644 --- a/.vscode/sjtubeamer.code-snippets +++ b/.vscode/sjtubeamer.code-snippets @@ -127,13 +127,13 @@ }, "stampbox": { "scope": "doctex,tex,latex", - "prefix": "stampbox", + "prefix": "\n\\begin{stampbox", "body": "\n\\begin{stampbox}[${1:cprimary}]\n\t$2\n\\end{stampbox}\n", "description": "Make a stampbox border, which is a decoration advice from SJTU VI. It has the dependency on stampline from sjtuvi package.\n" }, "codeblock": { "scope": "doctex,tex,latex", - "prefix": "codeblock", + "prefix": "\n\\begin{codeblock", "body": "\n\\begin{codeblock}[${1:}]{$2}\n\t$3\n\\end{codeblock}\n", "description": "Code block environment is made for presenting code in an obvious way. Two parameters are required. The first parameter is passed to listing, which mostly sets the language to highlight, see the listings package for more details. And the second parameter receives the title to make.\n" }, @@ -203,6 +203,12 @@ "body": "\\definelogo{$1}{$2}{$3}", "description": "Define a mask picture to make its different color variants.\nThe first argument assigns the file name and the second sets the horizontal cropping and the third sets the vertical cropping. Notice that the cropping is symmetrical (double the length). When the horizontal cropping is greater than the vertical cropping, the mask will be placed by its height, otherwise by its width. The domain for both cropping parameters is 0 to 1.\nYou should define a logo \\definelogo{mylogo}{}{} then use it in the contents like:\n\\mylogo[white], where the optional parameter could be the override color beyond the control of main logo color system or opacity=... to identify the opacity you want or any other parameter for a TikZ node.\nRemember, the picture should be in the vi/ folder.\nThe externalization will be disabled when using this system to generate logos, locally.\n" }, + "sjtubeamer@compatible": { + "scope": "doctex,tex", + "prefix": "\\sjtubeamer@compatible", + "body": "\\sjtubeamer@compatible", + "description": "" + }, "stamp": { "scope": "doctex,tex,latex", "prefix": "stamp", @@ -213,7 +219,7 @@ "scope": "doctex,tex,latex", "prefix": "\\stamparray", "body": "\\stamparray{$1}{$2}{$3}", - "description": "Create the stamp array in the TikZ environment.\n\nNotice \\TeX{} is not good at handling parameters. Always remember to store it into a temporary variable. Register \\pgfmathresult will store the result of \\pgfmathparse.\n" + "description": " Create the stamp array in the TikZ environment.\n\n Notice \\TeX{} is not good at handling parameters. Always remember to store it into a temporary variable. Register \\pgfmathresult will store the result of \\pgfmathparse.\n" }, "stampline": { "scope": "doctex,tex,latex", diff --git a/README.md b/README.md index fb55e72e..649720e0 100644 --- a/README.md +++ b/README.md @@ -31,7 +31,7 @@ SJTUBeamer 是上海交通大学的非官方 Beamer 模版。您可以使用 SJT % shadow tree smoothtree % *siderbar 推荐与 max 一起使用。 -% \tikzexternalize[prefix=cache/] +% \tikzexternalize[prefix=build/] % 如果您需要缓存 tikz 图像,请取消注释上一行,并在编译选项中添加 -shell-escape。 \usepackage[backend=biber,style=gb7714-2015]{biblatex} diff --git a/README_en.md b/README_en.md index c380d62f..df144651 100644 --- a/README_en.md +++ b/README_en.md @@ -29,7 +29,7 @@ Current document `main.tex` is an example documentation of *How to Use LaTeX to % shadow tree smoothtree % *siderbar is recommended to be used with max option. -% \tikzexternalize[prefix=cache/] +% \tikzexternalize[prefix=build/] % To cache the tikz picture, please uncomment the previous line. \usepackage{biblatex} diff --git a/beamercolorthemesjtubeamer.sty b/beamercolorthemesjtubeamer.sty index dbaaf9ff..d5ed1568 100644 --- a/beamercolorthemesjtubeamer.sty +++ b/beamercolorthemesjtubeamer.sty @@ -21,7 +21,7 @@ %% limitations under the License. %% ------------------------------------------------------------------------ \NeedsTeXFormat{LaTeX2e} -\ProvidesPackage{beamercolorthemesjtubeamer}[2021/11/22 sjtubeamer color theme v2.3.2] +\ProvidesPackage{beamercolorthemesjtubeamer}[2021/11/25 sjtubeamer color theme v2.4.0] \RequirePackage{sjtuvi} \DefineOption{color}{color}{red} \DefineOption{color}{color}{blue} diff --git a/beamerfontthemesjtubeamer.sty b/beamerfontthemesjtubeamer.sty index 1efa41c7..c5bf6556 100644 --- a/beamerfontthemesjtubeamer.sty +++ b/beamerfontthemesjtubeamer.sty @@ -21,7 +21,7 @@ %% limitations under the License. %% ------------------------------------------------------------------------ \NeedsTeXFormat{LaTeX2e} -\ProvidesPackage{beamerfontthemesjtubeamer}[2021/11/22 sjtubeamer font theme v2.3.2] +\ProvidesPackage{beamerfontthemesjtubeamer}[2021/11/25 sjtubeamer font theme v2.4.0] \RequirePackage{silence} \WarningFilter{latexfont}{Font shape} \usefonttheme{professionalfonts} diff --git a/beamerinnerthemesjtubeamer.sty b/beamerinnerthemesjtubeamer.sty index d787e0ac..c146fca5 100644 --- a/beamerinnerthemesjtubeamer.sty +++ b/beamerinnerthemesjtubeamer.sty @@ -21,7 +21,7 @@ %% limitations under the License. %% ------------------------------------------------------------------------ \NeedsTeXFormat{LaTeX2e} -\ProvidesPackage{beamerinnerthemesjtubeamer}[2021/11/22 sjtubeamer inner theme v2.3.2] +\ProvidesPackage{beamerinnerthemesjtubeamer}[2021/11/25 sjtubeamer inner theme v2.4.0] \RequirePackage{sjtuvi} \RequirePackage{tcolorbox} \DeclareOptionBeamer{maxplus}{\def\sjtubeamer@inner@cover{maxplus}} @@ -42,7 +42,6 @@ \DefineOption{inner}{color}{blue} \ExecuteOptionsBeamer{red} \ProcessOptionsBeamer -\PassOptionsToPackage{\sjtubeamer@inner@cover}{sjtucover} \if\EqualOption{inner}{color}{red} \colorlet{cprimary}{sjtuRedPrimary} \colorlet{csecondary}{sjtuRedSecondary} @@ -142,6 +141,8 @@ } } \RequirePackage{sjtucover} +\setbeamertemplate{title page}[\sjtubeamer@inner@cover] +\setbeamertemplate{bottom page}[\sjtubeamer@inner@cover][Thanks] \defbeamertemplate*{part page}{sjtubeamer}[1][] { \vfill diff --git a/beamerouterthemesjtubeamer.sty b/beamerouterthemesjtubeamer.sty index 1f58d63b..23ad4031 100644 --- a/beamerouterthemesjtubeamer.sty +++ b/beamerouterthemesjtubeamer.sty @@ -21,7 +21,7 @@ %% limitations under the License. %% ------------------------------------------------------------------------ \NeedsTeXFormat{LaTeX2e} -\ProvidesPackage{beamerouterthemesjtubeamer}[2021/11/22 sjtubeamer outer theme v2.3.2] +\ProvidesPackage{beamerouterthemesjtubeamer}[2021/11/25 sjtubeamer outer theme v2.4.0] \RequirePackage{sjtuvi} \DefineOption{outer}{nav}{miniframes} \DefineOption{outer}{nav}{infolines} diff --git a/beamerthemesjtubeamer.sty b/beamerthemesjtubeamer.sty index f1e6b99a..493c8e9a 100644 --- a/beamerthemesjtubeamer.sty +++ b/beamerthemesjtubeamer.sty @@ -21,7 +21,7 @@ %% limitations under the License. %% ------------------------------------------------------------------------ \NeedsTeXFormat{LaTeX2e} -\ProvidesPackage{beamerthemesjtubeamer}[2021/11/22 sjtubeamer parent theme v2.3.2] +\ProvidesPackage{beamerthemesjtubeamer}[2021/11/25 sjtubeamer parent theme v2.4.0] \DeclareOptionBeamer{maxplus}{ \def\sjtubeamer@cover{maxplus}\def\sjtubeamer@logopos{topright}} \DeclareOptionBeamer{max}{ diff --git a/main.tex b/main.tex index 9c645314..9a8c5cad 100644 --- a/main.tex +++ b/main.tex @@ -115,7 +115,7 @@ % shadow tree smoothtree % *siderbar 推荐与 max 一起使用。 -% \tikzexternalize[prefix=cache/] +% \tikzexternalize[prefix=build/] % 如果您需要缓存 tikz 图像,请取消注释上一行,并在编译选项中添加 -shell-escape。 \author{Alexara Wu} diff --git a/sjtucover.sty b/sjtucover.sty index d997554b..84aa4bd2 100644 --- a/sjtucover.sty +++ b/sjtucover.sty @@ -18,19 +18,8 @@ %% see https://vi.sjtu.edu.cn/index.php/articles/bulletin/16. %% ------------------------------------------------------------------------ \NeedsTeXFormat{LaTeX2e} -\ProvidesPackage{sjtucover}[2021/11/22 cover library for sjtubeamer v2.3.2] +\ProvidesPackage{sjtucover}[2021/11/25 cover library for sjtubeamer v2.4.0] \RequirePackage{sjtuvi} -\DeclareOptionBeamer{maxplus}{\def\sjtubeamer@sjtucover@cover{maxplus}} -\DeclareOptionBeamer{max}{\def\sjtubeamer@sjtucover@cover{max}} -\DeclareOptionBeamer{min}{\def\sjtubeamer@sjtucover@cover{min}} -\DeclareOptionBeamer{my}{\def\sjtubeamer@sjtucover@cover{my}} % reserved for customization -\ExecuteOptionsBeamer{ - maxplus, - min, - my, - max, -} -\ProcessOptionsBeamer \defbeamertemplate*{title page}{maxplus}[1][] { \nointerlineskip% @@ -128,19 +117,22 @@ \fill [palette primary.bg] (-0.2*\the\paperwidth,-1*\the\paperheight) rectangle (1*\the\paperwidth, 0.2*\the\paperheight); \end{tikzpicture} - \ifbeamer@draftmode% - \else% - \begin{tikzpicture}[overlay] - \stamparray{20pt} - {(-0.2*\the\paperwidth,-1*\the\paperheight)} - {(1*\the\paperwidth, 0.2*\the\paperheight)} - \fill [bg,path fading=fade right] - (-0.2*\the\paperwidth,-1*\the\paperheight) rectangle - (1*\the\paperwidth, 0.2*\the\paperheight); - \fill [bg,path fading=center fade,xshift=-10pt,yshift=-20pt] - (0.2*\the\paperwidth,0) circle [radius=\the\paperwidth]; - \end{tikzpicture} - \fi% + \ifx\sjtubeamer@compatible\sjtubeamer@compatible@false + \else + \ifbeamer@draftmode% + \else% + \begin{tikzpicture}[overlay] + \stamparray{20pt} + {(-0.2*\the\paperwidth,-1*\the\paperheight)} + {(1*\the\paperwidth, 0.2*\the\paperheight)} + \fill [bg,path fading=fade right] + (-0.2*\the\paperwidth,-1*\the\paperheight) rectangle + (1*\the\paperwidth, 0.2*\the\paperheight); + \fill [bg,path fading=center fade,xshift=-10pt,yshift=-20pt] + (0.2*\the\paperwidth,0) circle [radius=\the\paperwidth]; + \end{tikzpicture} + \fi% + \fi \vfill \begingroup \centering @@ -360,8 +352,6 @@ \usebeamercolor{palette primary} \def\sjtubeamer@logocolor{palette primary.fg} } -\setbeamertemplate{title page}[\sjtubeamer@sjtucover@cover] -\setbeamertemplate{bottom page}[\sjtubeamer@sjtucover@cover][Thanks] \endinput %% %% End of file `sjtucover.sty'. diff --git a/sjtuvi.sty b/sjtuvi.sty index 7baebb61..f1ed7df9 100644 --- a/sjtuvi.sty +++ b/sjtuvi.sty @@ -4,7 +4,7 @@ %% %% The original source files were: %% -%% sjtuvi.dtx (with options: `package,compatible') +%% sjtuvi.dtx (with options: `package') %% ------------------------------------------------------------------------ %% Copyright (C) Shanghai Jiao Tong University %% The definition in this file is referred to the Visual Identity System @@ -18,7 +18,7 @@ %% see https://vi.sjtu.edu.cn/index.php/articles/bulletin/16. %% ------------------------------------------------------------------------ \NeedsTeXFormat{LaTeX2e} -\ProvidesPackage{sjtuvi}[2021/11/22 Visual Identity System library for sjtubeamer v2.3.2] +\ProvidesPackage{sjtuvi}[2021/11/25 Visual Identity System library for sjtubeamer v2.4.0] \def\DefineOption#1#2#3{ % #1: package % #2: key @@ -37,7 +37,6 @@ \iftempif } \RequirePackage{tikz} -\usetikzlibrary{patterns.meta} \usetikzlibrary{fadings} \usetikzlibrary{decorations.pathmorphing} \usetikzlibrary{external} @@ -82,64 +81,73 @@ \definelogo{dlogo}{0}{0} \definelogo{vlogo}{0.8}{0.13} \definelogo{sjtubg}{0.3}{0.5} -\tikzdeclarepattern{ - name=stamp, - parameters={ - \pgfkeysvalueof{/pgf/pattern keys/size}, - \pgfkeysvalueof{/pgf/pattern keys/xshift}, - \pgfkeysvalueof{/pgf/pattern keys/yshift}, - }, - defaults={ - size/.initial = 5pt, - xshift/.initial = 0pt, - yshift/.initial = 0pt, - }, - bottom left={( - -0.5*\pgfkeysvalueof{/pgf/pattern keys/size} - +\pgfkeysvalueof{/pgf/pattern keys/xshift}, - -0.4*\pgfkeysvalueof{/pgf/pattern keys/size} - +\pgfkeysvalueof{/pgf/pattern keys/yshift} - )}, - top right={( - 0.5*\pgfkeysvalueof{/pgf/pattern keys/size} - +\pgfkeysvalueof{/pgf/pattern keys/xshift}, - 0.4*\pgfkeysvalueof{/pgf/pattern keys/size} - +\pgfkeysvalueof{/pgf/pattern keys/yshift} - )}, - tile size={( - \pgfkeysvalueof{/pgf/pattern keys/size}, - 0.8*\pgfkeysvalueof{/pgf/pattern keys/size} - )}, - code={ - \def\s{\pgfkeysvalueof{/pgf/pattern keys/size}}% - \tikzset{x=0.5*\s,y=0.2*\s} - \fill[xshift=\pgfkeysvalueof{/pgf/pattern keys/xshift}, - yshift=\pgfkeysvalueof{/pgf/pattern keys/yshift}] - (-0.25*\s,0) - -- (-0.17*\s,0.06*\s) - -- (-0.17*\s,0.1*\s) - -- (0.17*\s,0.1*\s) - -- (0.17*\s,0.06*\s) - -- (0.25*\s,0) - -- (0.17*\s,-0.06*\s) - -- (0.17*\s,-0.1*\s) - -- (-0.17*\s,-0.1*\s) - -- (-0.17*\s,-0.06*\s) -- cycle; - } -} -\providecommand{\stamparray}[3]{ - % #1: pattern size - % #2: starting point - % #3: ending point - \usebeamercolor{palette primary} - \fill [pattern={stamp[size=#1]}, - pattern color=bg!50!fg] #2 rectangle #3; - \def\s{#1}% - \pgfmathparse{0.5*\s}\let\xs=\pgfmathresult% - \pgfmathparse{-0.4*\s}\let\ys=\pgfmathresult% - \fill [pattern={stamp[size=#1,xshift=\xs, yshift=\ys]}, - pattern color=bg!50!fg] #2 rectangle #3; -} +\def\sjtubeamer@compatible@false{false} +\ifx\sjtubeamer@compatible\sjtubeamer@compatible@false +\else + \usetikzlibrary{patterns.meta} + \tikzdeclarepattern{ + name=stamp, + parameters={ + \pgfkeysvalueof{/pgf/pattern keys/size}, + \pgfkeysvalueof{/pgf/pattern keys/xshift}, + \pgfkeysvalueof{/pgf/pattern keys/yshift}, + }, + defaults={ + size/.initial = 5pt, + xshift/.initial = 0pt, + yshift/.initial = 0pt, + }, + bottom left={( + -0.5*\pgfkeysvalueof{/pgf/pattern keys/size} + +\pgfkeysvalueof{/pgf/pattern keys/xshift}, + -0.4*\pgfkeysvalueof{/pgf/pattern keys/size} + +\pgfkeysvalueof{/pgf/pattern keys/yshift} + )}, + top right={( + 0.5*\pgfkeysvalueof{/pgf/pattern keys/size} + +\pgfkeysvalueof{/pgf/pattern keys/xshift}, + 0.4*\pgfkeysvalueof{/pgf/pattern keys/size} + +\pgfkeysvalueof{/pgf/pattern keys/yshift} + )}, + tile size={( + \pgfkeysvalueof{/pgf/pattern keys/size}, + 0.8*\pgfkeysvalueof{/pgf/pattern keys/size} + )}, + code={ + \def\s{\pgfkeysvalueof{/pgf/pattern keys/size}}% + \tikzset{x=0.5*\s,y=0.2*\s} + \fill[xshift=\pgfkeysvalueof{/pgf/pattern keys/xshift}, + yshift=\pgfkeysvalueof{/pgf/pattern keys/yshift}] + (-0.25*\s,0) + -- (-0.17*\s,0.06*\s) + -- (-0.17*\s,0.1*\s) + -- (0.17*\s,0.1*\s) + -- (0.17*\s,0.06*\s) + -- (0.25*\s,0) + -- (0.17*\s,-0.06*\s) + -- (0.17*\s,-0.1*\s) + -- (-0.17*\s,-0.1*\s) + -- (-0.17*\s,-0.06*\s) -- cycle; + } + } +\fi +\ifx\sjtubeamer@compatible\sjtubeamer@compatible@false + \providecommand{\stamparray}[3]{} +\else + \providecommand{\stamparray}[3]{ + % #1: pattern size + % #2: starting point + % #3: ending point + \usebeamercolor{palette primary} + \fill [pattern={stamp[size=#1]}, + pattern color=bg!50!fg] #2 rectangle #3; + \def\s{#1}% + \pgfmathparse{0.5*\s}\let\xs=\pgfmathresult% + \pgfmathparse{-0.4*\s}\let\ys=\pgfmathresult% + \fill [pattern={stamp[size=#1,xshift=\xs, yshift=\ys]}, + pattern color=bg!50!fg] #2 rectangle #3; + } +\fi \pgfdeclaredecoration{stampline}{initial} { \state{initial}[ diff --git a/src/build.lua b/src/build.lua index f8de457f..69675ebf 100644 --- a/src/build.lua +++ b/src/build.lua @@ -10,8 +10,10 @@ docfiledir = "doc" if os.type == "windows" then typesetexe = "pdflatex" + etypesetexe = "etex" else typesetexe = "xelatex" + etypesetexe = "xetex" end typesetopts = "-interaction=nonstopmode -shell-escape" @@ -19,6 +21,7 @@ typesetfiles = {"sjtubeamerdevguide.tex","sjtubeamer.tex"} -- typesetfiles = {"sjtubeamer.tex"} -- typesetruns = 1 -- for debug. Some reference may not be linked. -- typesetdemofiles = {"min.tex"} +-- cachedemo = true -- cache the demo typesetsuppfiles = {"head.png","plant.jpg","test.csv","testgraph.tex","ref.bib","sjtug.pdf","sjtug_text.pdf","tutorial/"} -- Regression tests mainly test the decoupling properties between kernel modules. @@ -58,6 +61,28 @@ function update_tag(file,content,tagname,tagdate) return content end +function compile_file(dir, cmd, filename, native) + local errorlevel = 0 + if native then + errorlevel = tex(filename, dir, cmd) + else + errorlevel = run(dir, cmd .. " " .. filename) + end + if string.find(filename,"+") ~= nil then + if string.find(filename,"-") ~= nil then + -- biber after compiling the first time if it is marked as "-" + errorlevel = biber(string.gsub(filename,".tex",""),dir) + end + -- compile the second time if it is marked as "+" + if native then + errorlevel = tex(filename, dir, cmd) + else + errorlevel = run(dir,cmd .. " " .. filename) + end + end + return errorlevel +end + -- Generate tutorial files before compiling the doc. -- NOTICE: if you want to save the tourial step pdf, -- please enter support/tutorial and run cache_pdf.sh @@ -65,29 +90,77 @@ end function typeset_demo_tasks() local errorlevel = 0 local tutorialdir = typesetdir .. "/tutorial" - local typesetcommand = typesetexe .. " " .. typesetopts -- patch l3build + print("============================================================") print("If you want to save the previous demo files") - print("Please move the pdf into the support/tutorial directory.") + print("Please modify the cachedemo variable in build.lua file.") print("============================================================") + + print("Compiling precomiled header...") + local cacheable = true + local headerfilename = "commonheader" + local etypesetcommand = etypesetexe .. " -ini -interaction=nonstopmode -jobname=" .. headerfilename .. " \"&" .. typesetexe .. "\" mylatexformat.ltx " + errorlevel = tex("\"\"\"" .. headerfilename .. ".tex\"\"\"", tutorialdir, etypesetcommand) + if errorlevel ~= 0 then + print("common header compilation failed.") + cacheable = false + end + + -- Move generated files to the tutorial directory + -- Since mylatexformat doesn't support relative directory well. + for _,file in pairs(installfiles) do + cp(file, unpackdir, tutorialdir) + end + local typesetcommand = typesetexe .. " " .. typesetopts -- patch l3build + local cachedemo = cachedemo or false + if not cachedemo then + -- delete the cache + rm(tutorialdir, "step*.pdf") + rm(supportdir .. "/tutorial", "step*.pdf") + end for _, p in ipairs(filelist(tutorialdir, "step*.tex")) do local pdffilename = string.gsub(p,".tex",".pdf") - if fileexists(tutorialdir .. "/" .. pdffilename) == false then - errorlevel = tex(p,tutorialdir,typesetcommand) - if string.find(p,"+") ~= nil then - if string.find(p,"-") ~= nil then - -- biber after compiling the first time if it is marked as "-" - errorlevel = biber(string.gsub(p,".tex",""),tutorialdir) - end - -- compile the second time if it is marked as "+" - errorlevel = tex(p,tutorialdir,typesetcommand) - end + if p == "step0.tex" then + errorlevel = run(tutorialdir,typesetcommand .. " " .. p) if errorlevel ~= 0 then - print(pdffilename .. " compilation failed.") - return errorlevel + print("unable to cache, fallback to standard compilation.") + cacheable = false -- compile on test caching file failed. end else - print(pdffilename .. " exists.") + if fileexists(tutorialdir .. "/" .. pdffilename) == false then + local stepfile = io.open(tutorialdir .. "/" .. p, "r") + if cacheable and string.match(stepfile:read("l"),"\\documentclass{ctexbeamer}") ~= nil then + -- use the precompiled header to compile. + local cachedfilename = "tmp" .. p + local cachedfile = io.open(tutorialdir .. "/" .. cachedfilename, "w") + cachedfile:write("%&commonheader\n\\endofdump\n\\usepackage{ctex}\n") + for line in stepfile:lines("L") do + cachedfile:write(line) + end + cachedfile:close() + stepfile:close() + + errorlevel = compile_file(tutorialdir, typesetcommand, cachedfilename, false) + if errorlevel ~= 0 then + print(pdffilename .. " compilation failed.") + return errorlevel + end + errorlevel = ren(tutorialdir, "tmp" .. pdffilename, pdffilename) + else + -- fallback to standard compilation. + errorlevel = compile_file(tutorialdir, typesetcommand, p, true) + if errorlevel ~= 0 then + print(pdffilename .. " compilation failed.") + return errorlevel + end + end + if cachedemo then + -- cache the demo + cp(pdffilename, tutorialdir, supportdir .. "/tutorial") + end + else + print(pdffilename .. " exists.") + end end end return 0 @@ -166,6 +239,9 @@ function gen_snippets() if string.match(line, "\\end{macro}") ~= nil and in_macro ~= nil then -- This macro is processed complete. local match_comm = string.gsub(in_macro, "\\", "\\\\") + if captured == 3 then + match_comm = "\\n\\\\begin{" .. match_comm + end local scope = "doctex,tex" if (captured >= 2 or macro_body == "") and string.find(in_macro,"@") == nil then diff --git a/src/doc/dev.bib b/src/doc/dev.bib index 2a9a8009..393647c2 100644 --- a/src/doc/dev.bib +++ b/src/doc/dev.bib @@ -147,4 +147,20 @@ @Manual{graphics url = {https://www.latexstudio.net/archives/10738}, } +@Misc{mylatexot1, + author = {David Carlisle}, + month = mar, + title = {Answer to "Precompiled header with XeLaTeX not working"}, + year = {2017}, + url = {https://tex.stackexchange.com/a/359900/253485}, +} + +@Manual{ctex, + title = {C\TeX{} 宏集手册}, + author = {CTEX.ORG}, + month = jun, + year = {2021}, + url = {https://github.com/CTeX-org/ctex-kit}, +} + @Comment{jabref-meta: databaseType:bibtex;} diff --git a/src/doc/sjtubeamer.tex b/src/doc/sjtubeamer.tex index aaa510df..74f6b6bf 100644 --- a/src/doc/sjtubeamer.tex +++ b/src/doc/sjtubeamer.tex @@ -415,7 +415,7 @@ \section{缓存} \begin{commentlist} \item \themename\ 已经加载了 \verb"\usetikzlibrary{external}"。 - \item[\faExclamationTriangle] 如果使用的是 Overleaf 这种在线 \LaTeX\ 编译器,您必须要在主文档内使用 \verb"\tikzexternalize[prefix=cache/]" 命令,并且要在同级目录下新建 \verb"cache/" 文件夹,其中应该还有一个占位文档(比如 \verb".gitkeep")。可参见 \href{https://www.overleaf.com/learn/latex/Questions/I_have_a_lot_of_tikz%2C_matlab2tikz_or_pgfplots_figures%2C_so_I%27m_getting_a_compilation_timeout._Can_I_externalise_my_figures%3F}{相关说明}。 + \item[\faExclamationTriangle] 如果使用的是 Overleaf 这种在线 \LaTeX\ 编译器,您必须要在主文档内使用 \verb"\tikzexternalize[prefix=build/]" 命令,并且要在同级目录下新建 \verb"build/" 文件夹,其中应该还有一个占位文档(比如 \verb".gitkeep")。可参见 \href{https://www.overleaf.com/learn/latex/Questions/I_have_a_lot_of_tikz%2C_matlab2tikz_or_pgfplots_figures%2C_so_I%27m_getting_a_compilation_timeout._Can_I_externalise_my_figures%3F}{相关说明}。 \end{commentlist} % TODO: 以后的开发计划:Smart Diagram diff --git a/src/doc/sjtubeamerdevguide.tex b/src/doc/sjtubeamerdevguide.tex index 23a345c1..704d47d0 100644 --- a/src/doc/sjtubeamerdevguide.tex +++ b/src/doc/sjtubeamerdevguide.tex @@ -430,19 +430,19 @@ \subsection{Communication Model} \begin{table}[h] \begin{tabular}{l|>{\ttfamily}l|>{\ttfamily}l>{\ttfamily}l>{\ttfamily}l} - & parent & color & inner & outer \\ + & parent & color & inner & outer \\ \hline - cover & \textbackslash{}sjtubeamer@cover & & \textbackslash{}...@inner@cover & \\ - color & \textbackslash{}sjtubeamer@color & \textbackslash{}...@color@color & \textbackslash{}...@inner@color & \\ - lum & \textbackslash{}sjtubeamer@lum & \textbackslash{}...@clolor@lum & & \\ - lang & \textbackslash{}sjtubeamer@lang & & \textbackslash{}...@inner@lang & \\ - nav & \textbackslash{}sjtubeamer@nav & & & \textbackslash{}...@outer@nav + cover & \textbackslash{}sjtubeamer@cover & & \textbackslash{}...@inner@cover & \\ + color & \textbackslash{}sjtubeamer@color & \textbackslash{}...@color@color & \textbackslash{}...@inner@color & \\ + lum & \textbackslash{}sjtubeamer@lum & \textbackslash{}...@clolor@lum & & \\ + lang & \textbackslash{}sjtubeamer@lang & & \textbackslash{}...@inner@lang & \\ + nav & \textbackslash{}sjtubeamer@nav & & & \textbackslash{}...@outer@nav \\ + logopos & \textbackslash{}sjtubeamer@logopos & & & \textbackslash{}sjtubeamer@outer@logopos \\ \end{tabular} \vskip 3pt\moveright 0in\vbox{\hrule width3cm \vskip 3pt \moveleft 0em \vbox{ \hbox{$^{1}$ Since \texttt{font} theme doesn't get any parameters, the table omits this column.} \hbox{$^{2}$ ... means \texttt{sjtubeamer}.} - \hbox{$^{3}$ \texttt{sjtucover} gets \texttt{\textbackslash{}...@sjtucover@cover} from inner.} }} \end{table} @@ -559,15 +559,11 @@ \subsection{Old \TeX\ Distribution} To make full use of \themename\, we always recommend using the latest \TeX\ distribution. However, in some cases, an older \TeX\ distribution needs to be supported. -For compatibility issues, you need to close the ``compatible'' option in \verb"beamerthemesjtubeamer.ins" for older versions. Change the following line to achieve that. +For compatibility issues, you need to define the \verb"\sjtubeamer@compatible" variable to \verb"false" to close the related rendering before the theme is loaded. -\begin{verbatim} - \generate{\file{sjtuvi.sty}{% - \from{sjtuvi.dtx}{package,compatible}} - } - \end{verbatim} - -The following table shows the compilation test of older \TeX\ distribution, where $\circ$ means you have to close the ``compatible'' option. +\makeatletter +\def\sjtubeamer@compatible{false} +\makeatother \begin{tabular}{c|cccccccc} \TeX\ Live & 2021 & 2020 & 2019 & 2018 & 2017 & 2016 & 2015 & 2014 \\ @@ -575,6 +571,28 @@ \subsection{Old \TeX\ Distribution} Test & $\surd$ & $\surd$ & $\surd$ & $\circ$ & $\circ$ & $\circ$ & $\circ$ & \\ \end{tabular} +\subsection{Pre-Compilation} + +\themename\ is relatively a large project for developers. To boost up the compilation on 20+ unit tests, we introduced \texttt{mylatexformat} to cache the precompiled common header. However, this method comes with compatibility issues in that it only supports old packages \emph{without} using \texttt{fontspec} to load OpenType fonts. + +To dump the format on beamer, we have to reset the encoding to the old 7-bit default\cite{mylatexot1}. Since some sans fonts use a newer version. And it is not available for C\TeX{} in \hologo{XeLaTeX}, since it uses \texttt{fontspec} to load the font. What's more, if we decided to load \texttt{ctex} after loading \texttt{ctexbeamer}, the load on \texttt{ctex} will be skipped\cite{ctex}. And \themename\ has done some of the work similar to \texttt{ctexbeamer}. As a result, we need to split the document class loading line \texttt{\textbackslash documentclass\{ctexbeamer\}} into two parts, which means the loading time on \texttt{ctex} will not be saved: +\begin{verbatim} +%--- static ----- +\RequirePackage[OT1]{fontenc} +\documentclass{beamer} +%--- dynamic --- +\endofdump +\usepackage{ctex} +\end{verbatim} + +In practice, we find that the \texttt{path fading} in Ti\emph{k}Z is not compatible with the caching mechanism, and it introduces more issues in PDF compatibility. Before it is solved in a future version of Ti\emph{k}Z, the background pattern will be skipped in the title page template in \texttt{min} theme by adding \verb"\sjtubeamer@compatible" to \verb"false". + +If your unit test doesn't want to be cached, you could add a blank square brackets. +\begin{verbatim} + \documentclass[]{ctexbeamer} +\end{verbatim} + +More details about this experimental caching mechanism in \texttt{l3build doc}, see \texttt{build.lua}. And you could change the default behavior of caching the demo files by changing \texttt{cahcedemo} to \texttt{true}. \section{Developer} \begin{itemize} diff --git a/src/source/beamercolorthemesjtubeamer.dtx b/src/source/beamercolorthemesjtubeamer.dtx index 96c06d96..6fd08d6c 100644 --- a/src/source/beamercolorthemesjtubeamer.dtx +++ b/src/source/beamercolorthemesjtubeamer.dtx @@ -16,7 +16,7 @@ % \iffalse %<*package> \NeedsTeXFormat{LaTeX2e} -\ProvidesPackage{beamercolorthemesjtubeamer}[2021/11/22 sjtubeamer color theme v2.3.2] +\ProvidesPackage{beamercolorthemesjtubeamer}[2021/11/25 sjtubeamer color theme v2.4.0] % % \fi % \CheckSum{0} diff --git a/src/source/beamerfontthemesjtubeamer.dtx b/src/source/beamerfontthemesjtubeamer.dtx index cad41af9..76e73bfe 100644 --- a/src/source/beamerfontthemesjtubeamer.dtx +++ b/src/source/beamerfontthemesjtubeamer.dtx @@ -16,7 +16,7 @@ % \iffalse %<*package> \NeedsTeXFormat{LaTeX2e} -\ProvidesPackage{beamerfontthemesjtubeamer}[2021/11/22 sjtubeamer font theme v2.3.2] +\ProvidesPackage{beamerfontthemesjtubeamer}[2021/11/25 sjtubeamer font theme v2.4.0] % % \fi % \CheckSum{0} diff --git a/src/source/beamerinnerthemesjtubeamer.dtx b/src/source/beamerinnerthemesjtubeamer.dtx index 813ccf0c..0e6e69c9 100644 --- a/src/source/beamerinnerthemesjtubeamer.dtx +++ b/src/source/beamerinnerthemesjtubeamer.dtx @@ -16,7 +16,7 @@ % \iffalse %<*package> \NeedsTeXFormat{LaTeX2e} -\ProvidesPackage{beamerinnerthemesjtubeamer}[2021/11/22 sjtubeamer inner theme v2.3.2] +\ProvidesPackage{beamerinnerthemesjtubeamer}[2021/11/25 sjtubeamer inner theme v2.4.0] % % \fi % \CheckSum{0} @@ -101,7 +101,6 @@ % % \begin{macrocode} \ProcessOptionsBeamer -\PassOptionsToPackage{\sjtubeamer@inner@cover}{sjtucover} % \end{macrocode} % % Hard-coded color for blocks. A replica of color theme. @@ -312,6 +311,12 @@ \RequirePackage{sjtucover} % \end{macrocode} % +% Initialize the title page and bottom page when the package is loaded. +% \begin{macrocode} +\setbeamertemplate{title page}[\sjtubeamer@inner@cover] +\setbeamertemplate{bottom page}[\sjtubeamer@inner@cover][Thanks] +% \end{macrocode} +% % \subsubsection{Part Page} % \begin{macro}{\partpage} % Define the \verb"part page" beamer template. diff --git a/src/source/beamerouterthemesjtubeamer.dtx b/src/source/beamerouterthemesjtubeamer.dtx index 64567a0e..c4a019c7 100644 --- a/src/source/beamerouterthemesjtubeamer.dtx +++ b/src/source/beamerouterthemesjtubeamer.dtx @@ -16,7 +16,7 @@ % \iffalse %<*package> \NeedsTeXFormat{LaTeX2e} -\ProvidesPackage{beamerouterthemesjtubeamer}[2021/11/22 sjtubeamer outer theme v2.3.2] +\ProvidesPackage{beamerouterthemesjtubeamer}[2021/11/25 sjtubeamer outer theme v2.4.0] % % \fi % \CheckSum{0} diff --git a/src/source/beamerthemesjtubeamer.dtx b/src/source/beamerthemesjtubeamer.dtx index a3b3d4a7..b6e67eff 100644 --- a/src/source/beamerthemesjtubeamer.dtx +++ b/src/source/beamerthemesjtubeamer.dtx @@ -37,7 +37,7 @@ % ------------------------------------------------------------------- \fi % \iffalse \NeedsTeXFormat{LaTeX2e} -\ProvidesPackage{beamerthemesjtubeamer}[2021/11/22 sjtubeamer parent theme v2.3.2] +\ProvidesPackage{beamerthemesjtubeamer}[2021/11/25 sjtubeamer parent theme v2.4.0] % \fi % % \subsection{Parent Theme} diff --git a/src/source/beamerthemesjtubeamer.ins b/src/source/beamerthemesjtubeamer.ins index 97cab030..95da0971 100644 --- a/src/source/beamerthemesjtubeamer.ins +++ b/src/source/beamerthemesjtubeamer.ins @@ -73,8 +73,8 @@ see https://vi.sjtu.edu.cn/index.php/articles/bulletin/16. \from{sjtucover.dtx}{package\preserveoption}} } \generate{\file{sjtuvi.sty}{% - \from{sjtuvi.dtx}{package,compatible}} - } % if your system is too old, please close the "compatible" option. + \from{sjtuvi.dtx}{package}} + } \obeyspaces \Msg{**************************************************************} diff --git a/src/source/sjtucover.dtx b/src/source/sjtucover.dtx index acce37d9..cc95d1be 100644 --- a/src/source/sjtucover.dtx +++ b/src/source/sjtucover.dtx @@ -13,7 +13,7 @@ % \iffalse %<*package> \NeedsTeXFormat{LaTeX2e} -\ProvidesPackage{sjtucover}[2021/11/22 cover library for sjtubeamer v2.3.2] +\ProvidesPackage{sjtucover}[2021/11/25 cover library for sjtubeamer v2.4.0] % % \fi % \CheckSum{0} @@ -27,44 +27,10 @@ % % \subsubsection{Load Packages} % -% Load SJTU VI Library to get the definition on shapes. +% Load SJTU VI Library to get the definition on shapes. This will also provide \verb"\sjtubeamer@compatible" option. % \begin{macrocode} \RequirePackage{sjtuvi} -% \end{macrocode} -% -% \subsubsection{Option Declaration} -% -% -% \begin{macrocode} -%<*maxplus> -\DeclareOptionBeamer{maxplus}{\def\sjtubeamer@sjtucover@cover{maxplus}} -% -%<*max> -\DeclareOptionBeamer{max}{\def\sjtubeamer@sjtucover@cover{max}} -% -%<*min> -\DeclareOptionBeamer{min}{\def\sjtubeamer@sjtucover@cover{min}} -% -%<*my> -\DeclareOptionBeamer{my}{\def\sjtubeamer@sjtucover@cover{my}} % reserved for customization -% -\ExecuteOptionsBeamer{ -%<*maxplus> - maxplus, -% -%<*min> - min, -% -%<*my> - my, -% -%<*max> - max, -% -} -\ProcessOptionsBeamer -% \end{macrocode} -% +% \end{macrocode} % % \subsubsection{Title Page} % @@ -161,6 +127,7 @@ % % \paragraph{min.} % Declare two fadings: center fade and fade right. The center fade provides a radial fading on the right side of the title page. The fade right provides a linear fading to avoid the collision on the text in the left. +% WARNING: Now it is not used in the titlepage. % \begin{macrocode} %<*min> \tikzfading[ @@ -193,25 +160,27 @@ rectangle (1*\the\paperwidth, 0.2*\the\paperheight); \end{tikzpicture} % \end{macrocode} -% If it is in draftmode, no pattern will get rendered. -% \begin{macrocode} - \ifbeamer@draftmode% -% \end{macrocode} +% WARNING: The pattern in the title page is now deprecated for the unstability of the \verb"fadings" library in TikZ. If you want to use the pattern, please uncomment the code segement manually. The interface of \verb"stamparry" is functional. +% If it is in draftmode or it is not compatible, no pattern will get rendered. % Otherwise, the fade tile of stamp array will get covered on top of the background rectangle. % \verb"stamparray" is defined in \verb"SJTUvi". Then, a fade right covers this array layer and a center fade covers the previous result. % \begin{macrocode} - \else% - \begin{tikzpicture}[overlay] - \stamparray{20pt} - {(-0.2*\the\paperwidth,-1*\the\paperheight)} - {(1*\the\paperwidth, 0.2*\the\paperheight)} - \fill [bg,path fading=fade right] - (-0.2*\the\paperwidth,-1*\the\paperheight) rectangle - (1*\the\paperwidth, 0.2*\the\paperheight); - \fill [bg,path fading=center fade,xshift=-10pt,yshift=-20pt] - (0.2*\the\paperwidth,0) circle [radius=\the\paperwidth]; - \end{tikzpicture} - \fi% + \ifx\sjtubeamer@compatible\sjtubeamer@compatible@false + \else + \ifbeamer@draftmode% + \else% + \begin{tikzpicture}[overlay] + \stamparray{20pt} + {(-0.2*\the\paperwidth,-1*\the\paperheight)} + {(1*\the\paperwidth, 0.2*\the\paperheight)} + \fill [bg,path fading=fade right] + (-0.2*\the\paperwidth,-1*\the\paperheight) rectangle + (1*\the\paperwidth, 0.2*\the\paperheight); + \fill [bg,path fading=center fade,xshift=-10pt,yshift=-20pt] + (0.2*\the\paperwidth,0) circle [radius=\the\paperwidth]; + \end{tikzpicture} + \fi% + \fi % \end{macrocode} % Set a constraint in the vertical mode to make the following contents centered in the middle of the slide. % \begin{macrocode} @@ -493,11 +462,6 @@ % % \end{macrocode} % -% Initialize the title page and bottom page when the package is loaded. -% \begin{macrocode} -\setbeamertemplate{title page}[\sjtubeamer@sjtucover@cover] -\setbeamertemplate{bottom page}[\sjtubeamer@sjtucover@cover][Thanks] -% \end{macrocode} % % \iffalse % diff --git a/src/source/sjtuvi.dtx b/src/source/sjtuvi.dtx index e5daf291..afcb9c07 100644 --- a/src/source/sjtuvi.dtx +++ b/src/source/sjtuvi.dtx @@ -13,7 +13,7 @@ % \iffalse %<*package> \NeedsTeXFormat{LaTeX2e} -\ProvidesPackage{sjtuvi}[2021/11/22 Visual Identity System library for sjtubeamer v2.3.2] +\ProvidesPackage{sjtuvi}[2021/11/25 Visual Identity System library for sjtubeamer v2.4.0] % % \fi % \CheckSum{0} @@ -68,9 +68,6 @@ % \verb"external" provides the way for tikz externalization, which will reduce the number of repetitive rendering with the cached pdf. % \begin{macrocode} \RequirePackage{tikz} -%<*compatible> -\usetikzlibrary{patterns.meta} -% \usetikzlibrary{fadings} \usetikzlibrary{decorations.pathmorphing} \usetikzlibrary{external} @@ -148,85 +145,92 @@ % % % \subsubsection{Shape Declarations} +% \begin{macro}{\sjtubeamer@compatible} +% For \TeX Live 2018 and even older, it is \emph{not} compatible to use the patterns.meta library for making user-defined patterns. And fading is not available for caching. Please consider \verb"\def\sjtubeamer@compatible{false}" to match the following condition checking. Remember to use \verb"\makeatletter" and \verb"\makeatother" in \LaTeX{}. +% \begin{macrocode} +\def\sjtubeamer@compatible@false{false} +% \end{macrocode} +% \end{macro} +% % \begin{macro}{stamp} % Declare stamp pattern to make a stamp array. % % The newest version of TikZ provides the interface to user-define a pattern. Obeying compatibility philosophy, use \verb"\pgfkeyvalueof" interface to get parameters in a standard way. The unit is first tested in a standalone file and previewed by TikZEdt. % \begin{macrocode} -%<*compatible> -\tikzdeclarepattern{ - name=stamp, - parameters={ - \pgfkeysvalueof{/pgf/pattern keys/size}, - \pgfkeysvalueof{/pgf/pattern keys/xshift}, - \pgfkeysvalueof{/pgf/pattern keys/yshift}, - }, - defaults={ - size/.initial = 5pt, - xshift/.initial = 0pt, - yshift/.initial = 0pt, - }, - bottom left={( - -0.5*\pgfkeysvalueof{/pgf/pattern keys/size} - +\pgfkeysvalueof{/pgf/pattern keys/xshift}, - -0.4*\pgfkeysvalueof{/pgf/pattern keys/size} - +\pgfkeysvalueof{/pgf/pattern keys/yshift} - )}, - top right={( - 0.5*\pgfkeysvalueof{/pgf/pattern keys/size} - +\pgfkeysvalueof{/pgf/pattern keys/xshift}, - 0.4*\pgfkeysvalueof{/pgf/pattern keys/size} - +\pgfkeysvalueof{/pgf/pattern keys/yshift} - )}, - tile size={( - \pgfkeysvalueof{/pgf/pattern keys/size}, - 0.8*\pgfkeysvalueof{/pgf/pattern keys/size} - )}, - code={ - \def\s{\pgfkeysvalueof{/pgf/pattern keys/size}}% - \tikzset{x=0.5*\s,y=0.2*\s} - \fill[xshift=\pgfkeysvalueof{/pgf/pattern keys/xshift}, - yshift=\pgfkeysvalueof{/pgf/pattern keys/yshift}] - (-0.25*\s,0) - -- (-0.17*\s,0.06*\s) - -- (-0.17*\s,0.1*\s) - -- (0.17*\s,0.1*\s) - -- (0.17*\s,0.06*\s) - -- (0.25*\s,0) - -- (0.17*\s,-0.06*\s) - -- (0.17*\s,-0.1*\s) - -- (-0.17*\s,-0.1*\s) - -- (-0.17*\s,-0.06*\s) -- cycle; - } -} +\ifx\sjtubeamer@compatible\sjtubeamer@compatible@false +\else + \usetikzlibrary{patterns.meta} + \tikzdeclarepattern{ + name=stamp, + parameters={ + \pgfkeysvalueof{/pgf/pattern keys/size}, + \pgfkeysvalueof{/pgf/pattern keys/xshift}, + \pgfkeysvalueof{/pgf/pattern keys/yshift}, + }, + defaults={ + size/.initial = 5pt, + xshift/.initial = 0pt, + yshift/.initial = 0pt, + }, + bottom left={( + -0.5*\pgfkeysvalueof{/pgf/pattern keys/size} + +\pgfkeysvalueof{/pgf/pattern keys/xshift}, + -0.4*\pgfkeysvalueof{/pgf/pattern keys/size} + +\pgfkeysvalueof{/pgf/pattern keys/yshift} + )}, + top right={( + 0.5*\pgfkeysvalueof{/pgf/pattern keys/size} + +\pgfkeysvalueof{/pgf/pattern keys/xshift}, + 0.4*\pgfkeysvalueof{/pgf/pattern keys/size} + +\pgfkeysvalueof{/pgf/pattern keys/yshift} + )}, + tile size={( + \pgfkeysvalueof{/pgf/pattern keys/size}, + 0.8*\pgfkeysvalueof{/pgf/pattern keys/size} + )}, + code={ + \def\s{\pgfkeysvalueof{/pgf/pattern keys/size}}% + \tikzset{x=0.5*\s,y=0.2*\s} + \fill[xshift=\pgfkeysvalueof{/pgf/pattern keys/xshift}, + yshift=\pgfkeysvalueof{/pgf/pattern keys/yshift}] + (-0.25*\s,0) + -- (-0.17*\s,0.06*\s) + -- (-0.17*\s,0.1*\s) + -- (0.17*\s,0.1*\s) + -- (0.17*\s,0.06*\s) + -- (0.25*\s,0) + -- (0.17*\s,-0.06*\s) + -- (0.17*\s,-0.1*\s) + -- (-0.17*\s,-0.1*\s) + -- (-0.17*\s,-0.06*\s) -- cycle; + } + } +\fi % \end{macrocode} % \end{macro} % % \begin{macro}{\stamparray} -% Create the stamp array in the TikZ environment. +% Create the stamp array in the TikZ environment. % -% Notice \TeX{} is not good at handling parameters. Always remember to store it into a temporary variable. Register \verb"\pgfmathresult" will store the result of \verb"\pgfmathparse". +% Notice \TeX{} is not good at handling parameters. Always remember to store it into a temporary variable. Register \verb"\pgfmathresult" will store the result of \verb"\pgfmathparse". % \begin{macrocode} -\providecommand{\stamparray}[3]{ - % #1: pattern size - % #2: starting point - % #3: ending point - \usebeamercolor{palette primary} - \fill [pattern={stamp[size=#1]}, - pattern color=bg!50!fg] #2 rectangle #3; - \def\s{#1}% - \pgfmathparse{0.5*\s}\let\xs=\pgfmathresult% - \pgfmathparse{-0.4*\s}\let\ys=\pgfmathresult% - \fill [pattern={stamp[size=#1,xshift=\xs, yshift=\ys]}, - pattern color=bg!50!fg] #2 rectangle #3; -} -% -% \end{macrocode} -% For \TeX Live 2018 and even older, it is \emph{not} compatible to use the patterns.meta library for making user-defined patterns. The function will do nothing. -% \begin{macrocode} -%<*!compatible> -\providecommand{\stamparray}[3]{} -% +\ifx\sjtubeamer@compatible\sjtubeamer@compatible@false + \providecommand{\stamparray}[3]{} +\else + \providecommand{\stamparray}[3]{ + % #1: pattern size + % #2: starting point + % #3: ending point + \usebeamercolor{palette primary} + \fill [pattern={stamp[size=#1]}, + pattern color=bg!50!fg] #2 rectangle #3; + \def\s{#1}% + \pgfmathparse{0.5*\s}\let\xs=\pgfmathresult% + \pgfmathparse{-0.4*\s}\let\ys=\pgfmathresult% + \fill [pattern={stamp[size=#1,xshift=\xs, yshift=\ys]}, + pattern color=bg!50!fg] #2 rectangle #3; + } +\fi % \end{macrocode} % \end{macro} % diff --git a/cache/.gitkeep b/src/support/tutorial/build/.gitkeep similarity index 100% rename from cache/.gitkeep rename to src/support/tutorial/build/.gitkeep diff --git a/src/support/tutorial/cache/.gitkeep b/src/support/tutorial/cache/.gitkeep deleted file mode 100644 index e69de29b..00000000 diff --git a/src/support/tutorial/cache_pdf.sh b/src/support/tutorial/cache_pdf.sh deleted file mode 100644 index 9acb8915..00000000 --- a/src/support/tutorial/cache_pdf.sh +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/bash - -cp -f ../../build/doc/tutorial/*.pdf ./ \ No newline at end of file diff --git a/src/support/tutorial/clean_pdf.sh b/src/support/tutorial/clean_pdf.sh deleted file mode 100644 index aa4fbd36..00000000 --- a/src/support/tutorial/clean_pdf.sh +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/bash - -rm -f *.pdf \ No newline at end of file diff --git a/src/support/tutorial/commonheader.tex b/src/support/tutorial/commonheader.tex new file mode 100644 index 00000000..1a3de550 --- /dev/null +++ b/src/support/tutorial/commonheader.tex @@ -0,0 +1,18 @@ +\RequirePackage[OT1]{fontenc} % old 7-bit to dump +\documentclass{beamer} +\makeatletter +\def\sjtubeamer@compatible{false} +\makeatother +\usepackage{sjtuvi} % contains TikZ +\usepackage{sjtucover} +\usepackage{tcolorbox} +\tcbuselibrary{skins} +\tcbuselibrary{listingsutf8} +\makeatletter +\AtEndPreamble{ % patch the langauge if it is ctexbeamer + \def\bottomthanks{谢\,谢} +} +\makeatother +\begin{document} +% intentionally left blank +\end{document} \ No newline at end of file diff --git a/src/support/tutorial/compiledemo_win.ps1 b/src/support/tutorial/compiledemo_win.ps1 deleted file mode 100644 index 8dea19e2..00000000 --- a/src/support/tutorial/compiledemo_win.ps1 +++ /dev/null @@ -1,27 +0,0 @@ -# If you are windows user -# To compile the doc, go through -# this Powershell 7 Script First. - -# l3build has Windows bug on this. - -Set-Location ../.. - -Remove-Item -Path build/unpacked -Recurse - -# unpack the dtx files first. -l3build unpack - -Copy-Item -Path support -Destination build/unpacked/ -Recurse - -Copy-Item -Path support/* -Destination build/ - -Set-Location build/unpacked - -# Parallel is only available for PowerShell 7 -Get-ChildItem support/tutorial/step*.tex | ForEach-Object -Parallel { - latexmk $_ -xelatex -interaction=nonstopmode -} - -Copy-Item -Path step*.pdf -Destination ../../support/tutorial -Recurse - -Set-Location ../../support/tutorial \ No newline at end of file diff --git a/src/support/tutorial/step0.tex b/src/support/tutorial/step0.tex new file mode 100644 index 00000000..a4b4a7cd --- /dev/null +++ b/src/support/tutorial/step0.tex @@ -0,0 +1,11 @@ +%&commonheader +\endofdump +\usepackage{ctex} +\usetheme{sjtubeamer} +\begin{document} +\begin{frame} + 欢迎使用 SJTUBeamer! +\end{frame} +\end{document} +% This file will test the functionality of caching. +% If this fails, the build system will fallback to normal compilation. \ No newline at end of file diff --git a/src/support/tutorial/step17.tex b/src/support/tutorial/step17.tex index 730b20c2..2afda421 100644 --- a/src/support/tutorial/step17.tex +++ b/src/support/tutorial/step17.tex @@ -1,7 +1,7 @@ -\documentclass{ctexbeamer} +\documentclass[]{ctexbeamer} \usetheme{sjtubeamer} \usetikzlibrary{math} -\tikzexternalize[prefix=cache/] +\tikzexternalize[prefix=build/] \begin{document} \begin{frame} \frametitle{缓存插图} diff --git a/src/support/tutorial/step19.tex b/src/support/tutorial/step19.tex index 63166446..bf086d4f 100644 --- a/src/support/tutorial/step19.tex +++ b/src/support/tutorial/step19.tex @@ -1,4 +1,4 @@ -\documentclass{ctexbeamer} +\documentclass[]{ctexbeamer} \usetheme[min,blue,light]{sjtubeamer} \begin{document} \title{SJTUBeamer} diff --git a/src/support/tutorial/step20.tex b/src/support/tutorial/step20.tex index a224667b..ea23060d 100644 --- a/src/support/tutorial/step20.tex +++ b/src/support/tutorial/step20.tex @@ -1,4 +1,4 @@ -\documentclass{ctexbeamer} +\documentclass[]{ctexbeamer} \usetheme{sjtubeamer} \tikzfading[name=fade cover, left color=transparent!20,