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

  • 相关阅读:
    C#中发送邮件,包含Html代码 CDO.Message
    CodeSmith生成SQL Server视图的实体类脚本/对应的生成模板
    分享到微信朋友圈
    获取验证码效果和后台代码(js+html+cs)
    弹出遮罩层
    WebAPI上传文件
    zoj1665 dij变形
    hdu1535 SPFA
    hdu1217 floyd
    poj1703 并查集
  • 原文地址:https://www.cnblogs.com/cxxszz/p/12290893.html
Copyright © 2011-2022 走看看