zoukankan      html  css  js  c++  java
  • 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{})

    documentclass{article}
    usepackage{algorithm,algorithmic}
    usepackage{eqparbox}
    %
    enewcommand{algorithmiccomment}[1]{hfilleqparbox{COMMENT}{# #1}}
    
    enewcommand{algorithmiccomment}[1]{hfilleqparbox{COMMENT}{/* #1 */}}
    egin{document}
    	egin{algorithm}
    		egin{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

  • 相关阅读:
    浅谈动态开点线段树
    详解二叉查找树(BST)
    数组的随机打乱
    浅谈迭代加深搜索
    浅谈传递闭包问题
    详解权值线段树
    算法竞赛中桶的概念与应用
    NKOJ 1353 图形面积
    并查集 & 最小生成树详细讲解
    【线段树基础】NKOJ 1321 数列操作
  • 原文地址:https://www.cnblogs.com/cxxszz/p/12290893.html
Copyright © 2011-2022 走看看