Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor sjtucolordef to sjtuvi #26

Merged
merged 7 commits into from
Aug 19, 2021
Merged

Conversation

LogCreative
Copy link
Contributor

@LogCreative LogCreative commented Aug 18, 2021

该 PR 主要完成了 SJTUBeamermin 内部接口的统一与 VI 库的整合。

VI 库

sjtucolordef.stysjtuvishape.sty 整合成 sjtuvi.sty。并且优化了 VI 图标的插入方式:
采用 tikzfadingfrompicture 环境创建由图像建立的遮罩,然后在使用时对底部画布着色即可得到不同颜色的图案。8ea3467

曾经比较过采用 svg 转换成 tikz 坐标点阵的方法,效果欠佳,速度较慢(一个图形的代码越 380 行,点估计会有上千个,在分析阶段就会产生较长的时间)。这种方法仅仅是在原有插入图片的基础上在进行一遍绘制,没有丧失图形精度(使用 pdf)遮罩并且复杂多边形采用这种方法渲染确实会相较于前者更快。73c2770

现在的版本已经对代码进行适度抽象。

\definelogo{<file>}{<h|v|f>}
\begin{document}
    \<file>{<color>}
\end{document}

尝试将定义与执行合并,发现这种方式会导致潜在的 bug。如果定义代码处于一个 tikz 私域中,其相关属性就会被继承,从而导致定义出的遮罩错位。这种方式至少可以鼓励遮罩定义在正文域外。

现行结构

+----------------------------------------------------------+
+                         main.tex                         +
+----------------------------------------------------------+
+                        sjtubeamer                        +
+----------------------------------------------------------+
+    max     +                     min                     +
+            +---------------------------------------------+
+            +  color   +   inner   +   outer  +   font    + 
+----------------------------------------------+-----------+
+             sjtuvi                           +
+----------------------------------------------+
+              logo                            +
+----------------------------------------------+

LaTeX 比较聪明,在 \begin{document} 之前所有 .sty 文件的载入都有且仅有一次(相当于开了 #pragma once),不需要考虑重定义的问题(我才知道)。

下一步将会对 max 和 min 做进一步的结构整合。

@skyzh skyzh changed the title VI 库的整合 refactor sjtucolordef to sjtuvi Aug 19, 2021
Copy link
Member

@skyzh skyzh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good! btw, 之后我们可以考虑在 CI 里 build {red|blue|my}.pdf

你可以使用"Squash and Merge"合并这个 PR。

@LogCreative
Copy link
Contributor Author

Looks good! btw, 之后我们可以考虑在 CI 里 build {red|blue|my}.pdf

ok 合并的差不多就加这个 CI(主要后面 API 要大改😭),现在的设置实际上在 l3build 里内置了检查

@LogCreative LogCreative merged commit 6c1c06a into main Aug 19, 2021
@LogCreative LogCreative deleted the logcreative-deep-integration branch August 19, 2021 03:14
@LogCreative LogCreative restored the logcreative-deep-integration branch August 19, 2021 03:14
@LogCreative LogCreative mentioned this pull request Nov 29, 2021
3 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants