{"id":4533,"date":"2015-05-05T22:58:11","date_gmt":"2015-05-05T14:58:11","guid":{"rendered":"https:\/\/lttt.blog.ustc.edu.cn\/?p=4533"},"modified":"2015-05-05T22:58:11","modified_gmt":"2015-05-05T14:58:11","slug":"%e4%bd%bf%e7%94%a8latexindent%e8%87%aa%e5%8a%a8%e6%a0%bc%e5%bc%8f%e5%8c%96%e4%bd%a0%e7%9a%84tex%e6%96%87%e6%a1%a3","status":"publish","type":"post","link":"https:\/\/lttt.vanabel.cn\/?p=4533","title":{"rendered":"\u4f7f\u7528LaTeXindent\u81ea\u52a8\u683c\u5f0f\u5316\u4f60\u7684tex\u6587\u6863"},"content":{"rendered":"<p>\u5728\u4fee\u6539\u6587\u7ae0\u65f6\u5f88\u5bb9\u6613\u628a\u683c\u5f0f\u641e\u4e71\uff0c \u8fd9\u5c31\u9700\u8981\u91cd\u65b0\u683c\u5f0f\u5316\u6211\u4eec\u7684\u6587\u6863\u3002\u5728\u8fd9\u91cc\u8c08\u4e00\u4e0bWindows\u4e0b\u7684\u65b9\u6cd5\uff0c \u5373\u4f7f\u7528latexindent.exe\u6765\u683c\u5f0f\u5316\u4f60\u7684\u6587\u6863\u3002<\/p>\n<ol>\n<li>\u9996\u5148\uff0c \u6211\u4eec\u9700\u8981\u66f4\u65b0\u4e0bctex\u81ea\u5e26\u7684<code>latexindent.exe<\/code>\uff0c \u5426\u5219\u8001\u662f\u63d0\u9192\u6211\u4eec\uff1aThe Perl interpreter could not be found. \u4e3a\u6b64\uff0c \u53ea\u9700\u8981\u5230<a href=\"http:\/\/www.ctan.org\/tex-archive\/support\/latexindent\">ctan<\/a>\u4e0b\u8f7dla\u00adtexin\u00addent.exe, \u5e76\u641c\u7d22\u4f60ctex\u5b89\u88c5\u76ee\u5f55\u4e0b\u7684\u65e7latexindent.exe\uff0c \u7136\u540e\u8986\u76d6\u6389.<\/li>\n<li>\u7136\u540e\uff0c \u5b9a\u4f4d\u5230\u4f60\u8981\u683c\u5f0f\u5316\u7684tex\u6587\u4ef6\uff0c \u6211\u4eec\u8fd9\u91cc\u5047\u8bbe\u662f<code>D:\\test.tex<\/code>, \u8fd0\u884c<br \/>\n<code>latexindent -w test.tex<\/code><br \/>\n\u8fd9\u6837\u4f60\u91cd\u65b0\u6253\u5f00test.tex\u65f6\u5c31\u53d1\u73b0\u4ed6\u5df2\u7ecf\u91cd\u65b0\u683c\u5f0f\u5316\u4e86\u3002<\/li>\n<p><!--more--><\/p>\n<li>\u4e3a\u4e86\u5f97\u5230\u8f83\u597d\u7684\u6548\u679c\uff0c \u4e00\u822c\u6765\u8bf4\u73af\u5883\u90fd\u8981\u653e\u5230\u5355\u72ec\u7684\u4e00\u884c\u3002<\/li>\n<li>\u6700\u540e\uff0c \u8fd8\u53ef\u4ee5\u7528\u81ea\u5df1\u7684\u914d\u7f6e\u6587\u4ef6\u6765\u8bbe\u7f6e\u683c\u5f0f\u3002\u4e3a\u6b64\uff0c \u5728\u4e0a\u9762\u7684ctan\u4e0b\u8f7d<code>de\u00adfault\u00adSet\u00adtings.yaml<\/code>\u5230\u4f60test.tex\u540c\u76ee\u5f55\uff0c \u7136\u540e\u590d\u5236\u4e00\u4efd\u5230<code>localSettings.yaml<\/code>, \u6211\u628a<code>\\t<\/code>\u90fd\u66ff\u6362\u4e3a\u4e24\u4e2a\u7a7a\u683c\uff0c \u5e76\u4fdd\u5b58\u3002\u7136\u540e\u53ea\u9700\u5728\u4f60\u524d\u9762\u7684\u683c\u5f0f\u5316\u547d\u4ee4\u4e2d\u6dfb\u52a0<code>-l<\/code>\u5f00\u5173\u5373\u53ef\u3002 \u5373<br \/>\n<code>latexindent -w -l test.tex<\/code><\/li>\n<li>\u6700\u540e\uff0c \u6211\u4eec\u8fd8\u53ef\u4ee5\u4e3aWinEdt\u6dfb\u52a0\u4e00\u4e2aLaTeX-Indent\u83dc\u5355\u3002\u4e3a\u6b64\uff0c \u53ea\u9700\u8981\u6253\u5f00options->options interface->Menus and Toolbar->Main Menu\uff0c \u7136\u540e\u5728\u6700\u540e\u4e00\u4e2aEND\u4e4b\u524d\u6dfb\u52a0\u5982\u4e0b\u4ee3\u7801\uff0c \u4fdd\u5b58\u5e76\u6309F9\u52a0\u8f7d\u5373\u53ef\u770b\u5230\u83dc\u5355\uff1a\n<pre>\nMENU=\"&LaTeX-Indent\"\n ITEM=\"LaTeX-Indent\"\n     CAPTION=\"latexindent\"\n     IMAGE=\"TeXIconTeX\"\n     SAVE_INPUT=1\n     MACRO=`WinExe('','latexindent -w -l \"%F\"','%P','LaTeX-Indent...',100,0,'','','',11);`\n     SHORTCUT=\"24649::Shift+Ctrl+I\"\n     REQ_FILTER=:\"%!M=TeX\"|\"%!M=TeX:STY\"|\"%!M=TeX:AUX\" \n<\/pre>\n<\/li>\n<\/ol>\n<p>\u9644\u4e0a\u6211\u4fee\u6539\u540e\u7684yaml\u6587\u4ef6\uff1a<\/p>\n<pre class=\"lang:yaml decode:true \" ># \n# defaultSettings.yaml\n#\n# You're welcome to change anything you like in here, but \n# it would probably be better to have your own user settings \n# files somewhere else- remember that this file may be overwritten\n# anytime that you update your distribution. Please see the manual\n# for details of how to setup your own settings files.\n#\n# Please read the manual first to understand what each switch does :)\n\n# Default value of indentation\ndefaultIndent: \" \"\n\n# default file extension of backup file (if original is overwritten with -w switch)\n# for example, if your .tex file is called\n#       myfile.tex\n# and you specify the backupExtension as BACKUP.bak then your \n# backup file will be\n#       myfileBACKUP.bak\nbackupExtension: .bak\n\n# only one backup per file; if onlyOneBackUp is 0 then the\n# number on the extension increments by 1 each time\n# (this is in place as a safety measure) myfile.bak0, myfile.bak1, myfile.bak2\n#\n# if you set onlyOnebackUp to 1, then the backup file will\n# be overwritten each time (not recommended until you trust the script)\nonlyOneBackUp: 0\n\n# some users may only want a set number of backup files, \n# say at most 3; in which case, they can change this switch.\n# If maxNumberOfBackUps is set to 0 (or less) then infinitely \n# many backups are possible, unless onlyOneBackUp is switched on\nmaxNumberOfBackUps: 0\n\n# some users may wish to cycle through back up files, for example, \n# with maxNumberOfBackUps: 4, they may wish to delete the oldest\n# back up file, and keep only the most recent.\n#\n#    copy myfile.bak1 to myfile.bak0\n#    copy myfile.bak2 to myfile.bak1\n#    copy myfile.bak3 to myfile.bak2\n#    copy myfile.bak4 to myfile.bak3\n#\n# the back up will be written to myfile.bak4\ncycleThroughBackUps: 0\n\n# indent preamble\nindentPreamble: 0\n\n# always look for split { }, which means that the user doesn't\n# have to complete checkunmatched, checkunmatchedELSE\nalwaysLookforSplitBraces: 1\n\n# always look for split [ ], which means that the user doesn't\n# have to complete checkunmatchedbracket\nalwaysLookforSplitBrackets: 1\n\n# remove trailing whitespace from all lines \nremoveTrailingWhitespace: 1\n\n# environments that have tab delimiters, add more \n# as needed\nlookForAlignDelims:\n   tabular: 1\n   tabularx: 1\n   longtable: 1\n   array: 1\n   matrix: 1\n   bmatrix: 1\n   pmatrix: 1\n   align: 1\n   align*: 1\n   alignat: 1\n   alignat*: 1\n   aligned: 1\n   cases: 1\n   dcases: 1\n   listabla: 1\n\n# if you have indent rules for particular environments\n# or commands, put them in here; for example, you might just want \n# to use a space \" \" or maybe a double tab \"  \"\nindentRules:\n   myenvironment: \"  \"\n   anotherenvironment: \"  \"\n   chapter: \" \"\n   section: \" \"\n   item: \"  \"\n\n#  verbatim environments- environments specified \n#  in this hash table will not be changed at all!\nverbatimEnvironments:\n    verbatim: 1\n    lstlisting: 1\n\n#  no indent blocks (not necessarily verbatim \n#  environments) which are marked as %\\begin{noindent}\n#  or anything else that the user puts in this hash\n#  table\nnoIndentBlock:\n    noindent: 1\n    cmhtest: 1\n\n# if you don't want to have additional indentation \n# in an environment put it in this hash table; note that\n# environments in this hash table will inherit \n# the *current* level of indentation they just won't\n# get any *additional*.\nnoAdditionalIndent:\n    myexample: 1\n    mydefinition: 1\n    problem: 1\n    exercises: 1\n    mysolution: 1\n    foreach: 0\n    widepage: 1\n    comment: 1\n    \\[: 0\n    \\]: 0\n    document: 1\n    frame: 0\n\n# if you want to add indentation after\n# a heading, such as \\part, \\chapter, etc\n# then populate it in here - you can add \n# an indent rule to indentRules if you would \n# like something other than defaultIndent\n#\n# you can also change the level if you like, \n# or add your own title command\nindentAfterHeadings:\n    part:\n       indent: 0\n       level: 1\n    chapter: \n       indent: 0\n       level: 2\n    section:\n       indent: 0\n       level: 3\n    subsection:\n       indent: 0\n       level: 4\n    subsection*:\n       indent: 0\n       level: 4\n    subsubsection:\n       indent: 0\n       level: 5\n    paragraph:\n       indent: 0\n       level: 6\n    subparagraph:\n       indent: 0\n       level: 7\n\n# if you want the script to look for \\item commands \n# and format it, as follows (for example),\n#       \\begin{itemize}\n#           \\item content here\n#                 next line is indented\n#                 next line is indented\n#           \\item another item\n#       \\end{itemize}\n# then populate indentAfterItems. See also itemNames\nindentAfterItems:\n    itemize: 1\n    enumerate: 1\n    list: 1\n\n# if you want to use other names for your items (such as, for example, part)\n# then populate them here- note that you can trick latexindent.pl\n# into indenting all kinds of commands (within environments specified in \n# indentAfterItems) using this technique.\nitemNames:\n    item: 1\n    myitem: 1\n\n# if you want to indent if, else, fi constructs such as, for example,\n#\n#       \\ifnum#1=2\n#               something\n#       \\else\n#               something else\n#       \\fi\n#\n# then populate them in constructIfElseFi\nconstructIfElseFi:\n    ifnum: 1\n    ifdim: 1\n    ifodd: 1\n    ifvmode: 1\n    ifhmode: 1\n    ifmmode: 1\n    ifinner: 1\n    if: 1\n    ifcat: 1\n    ifx: 1\n    ifvoid: 1\n    ifeof: 1\n    iftrue: 1\n    ifcase: 1\n    \n# *** NOTE ***\n# If you have specified alwaysLookforSplitBraces: 1\n# and alwaysLookforSplitBrackets: 1 then you don't need\n# to worry about completing\n#\n#       checkunmatched\n#       checkunmatchedELSE\n#       checkunmatchedbracket\n#\n# in other words, you don't really need to edit anything \n# below this line- it used to be necessary for older \n# versions of the script, but not anymore :)\n#***      ***\n\n# commands that might split {} across lines\n# such as \\parbox, \\marginpar, etc\ncheckunmatched:\n    parbox: 1\n    vbox: 1\n\n# very similar to %checkunmatched except these \n# commands might have an else construct\ncheckunmatchedELSE:\n    pgfkeysifdefined: 1\n    DTLforeach: 1\n    ifthenelse: 1\n\n# commands that might split []  across lines\n# such as \\pgfplotstablecreatecol, etc\ncheckunmatchedbracket:\n    pgfplotstablecreatecol: 1\n    pgfplotstablesave: 1\n    pgfplotstabletypeset: 1\n    mycommand: 1\n    psSolid: 1<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>\u5728\u4fee\u6539\u6587\u7ae0\u65f6\u5f88\u5bb9\u6613\u628a\u683c\u5f0f\u641e\u4e71\uff0c \u8fd9\u5c31\u9700\u8981\u91cd\u65b0\u683c\u5f0f\u5316\u6211\u4eec\u7684\u6587\u6863\u3002\u5728\u8fd9\u91cc\u8c08\u4e00\u4e0bWin &hellip;<\/p>\n<p class=\"read-more\"> <a class=\"more-link\" href=\"https:\/\/lttt.vanabel.cn\/?p=4533\"> <span class=\"screen-reader-text\">\u4f7f\u7528LaTeXindent\u81ea\u52a8\u683c\u5f0f\u5316\u4f60\u7684tex\u6587\u6863<\/span> \u9605\u8bfb\u66f4\u591a &raquo;<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[7],"tags":[715],"class_list":["post-4533","post","type-post","status-publish","format-standard","hentry","category-latex","tag--latexindent"],"_links":{"self":[{"href":"https:\/\/lttt.vanabel.cn\/index.php?rest_route=\/wp\/v2\/posts\/4533","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/lttt.vanabel.cn\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/lttt.vanabel.cn\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/lttt.vanabel.cn\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/lttt.vanabel.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=4533"}],"version-history":[{"count":0,"href":"https:\/\/lttt.vanabel.cn\/index.php?rest_route=\/wp\/v2\/posts\/4533\/revisions"}],"wp:attachment":[{"href":"https:\/\/lttt.vanabel.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=4533"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/lttt.vanabel.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=4533"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/lttt.vanabel.cn\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=4533"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}