LaTex Tricks
TeXstudio has the Ctrl+T/U shortcuts for commenting/uncommenting multilines.
Comment in pseudocodes (Just for use with package algorithmic. For algorithmicx, simply use \Comment{})
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 | \documentclass{article} \usepackage{algorithm,algorithmic} \usepackage{eqparbox} %\renewcommand{\algorithmiccomment}[1]{\hfill\eqparbox{COMMENT}{\ # #1}} \renewcommand{\algorithmiccomment}[1]{\hfill\eqparbox{COMMENT}{/* #1 */}} \begin{document} \begin{algorithm} \begin{algorithmic}[1] \STATE $ sum =0$; \FOR[comment for FOR]{$j=1$ \TO $100$} \IF[comment for IF]{$j\%2==1$} \STATE $ sum = sum +i$; \COMMENT{normal comment} \ENDIF \ENDFOR \end{algorithmic} \end{algorithm} \end{document} |
LaTex algorithm Packages (ACK:https://tex.stackexchange.com/questions/229355/algorithm-algorithmic-algorithmicx-algorithm2e-algpseudocode-confused)
- algorithm - float wrapper for algorithms.
- algorithmic - first algorithm typesetting environment.
- algorithmicx - second algorithm typesetting environment.
- algpseudocode - layout for
algorithmicx
. - algorithm2e - third algorithm typesetting environment.
I use algorithmicx
with algpseudocode
since they are superior to algorithmic
. I think algorithmicx
offers the same functionality compared to algorithm2e
, but I find its syntax clearer than the one provided by algorithm2e
.
Algorithm vs. Procedure (Ack https://qr.ae/pGOhuN)
A procedure which always terminates is called an algorithm.
The notion of a procedure and an algorithm is formally defined in the book “ Formal Languages and their relation to Automata “ (1969), by hopcroft and ullman. https://savedparadigms.files.wordpress.com/2014/09/formal-languages-and-their-relation-to-automata-john-e-hopcroft-jeffrey-d-ullman.pdf
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】凌霞软件回馈社区,博客园 & 1Panel & Halo 联合会员上线
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】博客园社区专享云产品让利特惠,阿里云新客6.5折上折
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步