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

algorithm环境单独一页? #30

Closed
tangjie1992 opened this Issue Mar 6, 2018 · 5 comments

Comments

Projects
None yet
2 participants
@tangjie1992
Copy link

tangjie1992 commented Mar 6, 2018

貌似配置本身没有algorithm环境?
注释里的list参数添加到 \usepackage[super,myhdr,tikz,list]{Style/artratex}好像也不管用,使用方式不对吗?

[list] % provide enhanced list environments for algorithm and coding

然后我就在手动添加了
\usepackage{algorithm}
\usepackage{algorithmic}

再输入伪代码的时候是这样写的:

\begin{algorithm}
\caption{***}\label{***}
\begin{algorithmic}
****
\end{algorithmic}
\end{algorithm}

结果就是伪代码模块经常单独成一页,除非当前页能放下。
由于我的伪代码略微偏长,大约2/3页面,如果单独成页的话很明显的页面上下都有一段空白。

问题就是:伪代码这种浮动体与图片那种浮动体应该不一样吧,毕竟是纯文字的,应该是可以跨页的才对吧,请问怎么设置啊。。
能不能再模版里优化一下,谢谢了~~~

@mohuangrui

This comment has been minimized.

Copy link
Owner

mohuangrui commented Mar 6, 2018

你好,algorithm的问题是属于LaTeX一般性的问题,并非ucasthesis需要去承担的功能。list选项调用的是listing宏包,其功能是能将你的源代码与tex代码独立开来,每个源代码可单独成一个文件,然后在tex内调用即可,而且其排版可以自动分页,详见 https://en.wikibooks.org/wiki/LaTeX/Source_Code_Listings

至于伪代码这样的,你可以详细阅读其相应的宏包说明文档,还有 https://en.wikibooks.org/wiki/LaTeX/Algorithms ,我并不推荐调用这类的,因为你还得针对它的语法去写算法,更推荐listing宏包的理念。

@tangjie1992

This comment has been minimized.

Copy link
Author

tangjie1992 commented Mar 6, 2018

你好,上面那两个链接我都看了,
listing这种抄录环境,简洁是简洁了,但是问题是listing环境似乎无法嵌套公式了,而 algorithm环境是可以的:

- 比如根号、幂、下标、求和符号之类的
- 还有些特殊的:$\mathcal{Q}$之类的

好吧,感觉抄录环境确实不大可能嵌套公式,我还是再试试怎么让algorithm跨页吧。
你要知道的话能否回一个,不知道的话我就自己再想想招吧

谢谢了~~

@mohuangrui

This comment has been minimized.

Copy link
Owner

mohuangrui commented Mar 6, 2018

那样的话建议你阅读algorithm的用户文档,祝一切顺利

@tangjie1992

This comment has been minimized.

Copy link
Author

tangjie1992 commented Mar 6, 2018

@mohuangrui

This comment has been minimized.

Copy link
Owner

mohuangrui commented Mar 6, 2018

Wikibook https://en.wikibooks.org/wiki/LaTeX/Algorithms 里就有讲到 Typesetting using the algorithmicx package, 然后 https://ctan.org/pkg/algorithmicx?lang=en 有其官方文档。 stackexchange 是比较现成,但可能被国内屏蔽了,还有就是信息分散。绝大多数时候还是更建议看用户文档的。

@mohuangrui mohuangrui closed this Mar 7, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.