ÊÖ°ÑÊÖ´øÄãÔÚvscodeÖÐÉèÖÃlatex
vscodeÖÐÔõÑùÉèÖÃlatex£¿ÏÂÃ汾ƪÎÄÕ¾ÍÀ´´ø¸÷ÈËÒ»²½²½ÔÚvscodeÖÐÉèÖÃlatex£¬Ï£Íû¶Ô¸÷ÈËÓÐËù×ÊÖú£¡
֮ǰһֱÓõÄÊÇtexstudioдÂÛÎÄ£¬µ«ÎÒÒÔΪtexstudioµÄuiÇ·ÔÃÄ¿£¬¼ÓÉÏÏÖʵʹÓÃÀú³ÌÖУ¬texstudioµÄ¹¤¾ßÀ¸ÄÚÀïÄÇЩ¹¦Ð§ÎÒһֱûÓÐÓùý£¬Ö»ÐèÒª¼òÆӵرàдtexÎĵµ¾Í×ã¹»ÁË£¬ÒÔÊÇ˼Á¿Ê¹ÓÃÒ»¿îÑÕÖµ¸ß²¢ÇÒ½ÏÁ¿ÇáÁ¿»¯µÄÎĵµ±à¼Æ÷£¬Òò´Ëvscode¾Í½øÈëÁËÎÒµÄÊÓÏßÖ®ÖС£
¾ÓÉÒ»·¬ÉèÖã¬ÎÒÀֳɵØÔÚvscodeÄÚÀïµ÷ºÃÁËtexµÄ±àдÇéÐΣ¬Ð¡ÎÒ˽ÈËÌå¸ÐºÍtexstudioʹÓøÐÊܲîδ¼¸£¬µ«ÑÕÖµ¸üºÃ£¬Ê¹ÓÃÆðÀ´½ÏÁ¿¿ªÐÄ£¡Ð´ÕâƪÎĵµÊÇΪÁ˼ͼһÏÂÉèÖÃÐĵ㬱ÜÃâ×Ô¼ºÒÅÍü£¬Í¬Ê±×öÒ»¸öÊä³ö£¬ÈÃ×Ô¼ºÏû»¯Ò»ÏÂ֪ʶ¡£
ÐèÒªÏÈ˵Ã÷£¬ÕâƪÎĵµÄÚÀïÒѾĬÈ϶ÁÕß×°ÖúÃtexliveºÍvscode¡£
1¡¢latexÔÚvscodeÖеÄÉèÖÃ
vscodeÄÚÀïÉèÖÃtex½ÏÁ¿¼òÆÓ£¬·ÖΪÁ½²½£º£¨1£©×°ÖÃÀ©Õ¹£¬£¨2£©Ìí¼ÓÉèÖᣡ¾ÍƼöѧϰ£ºvscode½Ì³Ì¡¢±à³Ì½Ìѧ¡¿
1.1¡¢ ×°ÖÃÀ©Õ¹
·¿ªvscode£¬×ó±ß¹¤¾ßÀ¸ÀïÓиöÀ©Õ¹À¸£¬Ñ¡ÖÐËü£¡ÔÙÔÚËÑË÷¿òÄÚÀïËÑË÷latex£¬ÈçÏÂͼËùʾ¡£
ÔÚÀ©Õ¹µÄÏÂͼÖбêºÅΪ1µÄÒÑ×°ÖÃÖп´Ò»Ï·ºÆðLaTex WorkshopûÓУ¬ÒªÊÇÓУ¬ËµÃ÷×°ÖÃÀֳɣ»»òÕß¿´¿´ÏÂͼÖбêºÅΪ2µÄºì¿òÊÇ·ñÏÔʾ³ÉͼÖÐÄÇÑù£¬ÈôÊÇÊÇ£¬ÔòÅú×¢×°ÖÃÀֳɡ£
1.2¡¢Ìí¼ÓÉèÖÃ
ÔÚvscodeÒ³Ã棬°´ÏÂf1£¬ÊäÈëjson£¬Ñ¡ÔñÊ×Ñ¡Ï·¿ªÉèÖÃÕâÒ»ÏÈçÏÂͼËùʾ¡£
·ºÆðÈçÏÂͼËùʾµÄÒ³Ãæ¡£
ÔÚÕâ¸ö»¨À¨ºÅÖоͿÉÒÔÊäÈëÉèÖôúÂëÁË£¬´úÂëÈçÏ£º
"latex-workshop.latex.tools": [ { "name": "pdflatex", "command": "pdflatex", "args": [ "-synctex=1", "-interaction=nonstopmode", "-file-line-error", "%DOCFILE%" ] }, { "name": "xelatex", "command": "xelatex", "args": [ "-synctex=1", "-interaction=nonstopmode", "-file-line-error", "%DOCFILE%" ] }, { "name": "bibtex", "command": "bibtex", "args": [ "%DOCFILE%" ] }],"latex-workshop.latex.recipes": [ { "name": "xelatex", "tools": [ "xelatex" ], }, { "name": "pdflatex", "tools": [ "pdflatex" ] }, { "name": "xe->bib->xe->xe", "tools": [ "xelatex", "bibtex", "xelatex", "xelatex" ] }, { "name": "pdf->bib->pdf->pdf", "tools": [ "pdflatex", "bibtex", "pdflatex", "pdflatex" ] }],"latex-workshop.latex.clean.fileTypes": [ "*.aux", "*.bbl", "*.blg", "*.idx", "*.ind", "*.lof", "*.lot", "*.out", "*.toc", "*.acn", "*.acr", "*.alg", "*.glg", "*.glo", "*.gls", "*.ist", "*.fls", "*.log", "*.fdb_latexmk"],//texÎļþä¯ÀÀÆ÷£¬¿ÉÑ¡ÏîΪ"none" "browser" "tab" "external""latex-workshop.view.pdf.viewer": "tab",//×Ô¶¯±àÒëtexÎļþ"latex-workshop.latex.autoBuild.run": "onFileChange",//ÏÔʾÄÚÈݲ˵¥£º£¨1£©±àÒëÎļþ£»£¨2£©¶¨Î»Óαê"latex-workshop.showContextMenu": true,//ÏÔʾ¹ýʧ"latex-workshop.message.error.show": false,//ÏÔʾÖÒÑÔ"latex-workshop.message.warning.show": false,//´ÓʹÓõİüÖÐ×Ô¶¯²¹È«ÏÂÁîºÍÇéÐÎ"latex-workshop.intellisense.package.enabled": true,//ÉèÖÃΪnever£¬Îª²»É¨³ý¸¨ÖúÎļþ"latex-workshop.latex.autoClean.run": "never",//ÉèÖÃvscode±àÒëtexÎĵµÊ±µÄĬÈϱàÒëÁ´"latex-workshop.latex.recipe.default": "lastUsed",// ÓÃÓÚ·´Ïòͬ²½µÄÄÚ²¿Éó²éÆ÷µÄ¼ü°ó¶¨¡£ctrl/cmd +µã»÷(ĬÈÏ)»òË«»÷"latex-workshop.view.pdf.internal.synctex.keybinding": "double-click",
µÇ¼ºó¸´ÖÆ
×¢ÖØ£¬Ò»¶¨ÒªÔÚ»¨À¨ºÅÄÚÀïÊäÈë°¡£¡
ÈôÊÇ»¨À¨ºÅÄÚÀïÓÐÆäËûдºÃµÄÉèÖ㬼ǵÃÔÚ×îºóÒ»ÐдúÂëÉϼӸöÓ¢ÎĶººÅ£¬ÔÙÁíÆðÒ»ÐУ¬Ð´ºÃlatexµÄÉèÖá£
2 ²âÊÔ
ÏÂÃæ²âÊÔÒ»ÏÂÒѾÉèÖúõÄvscodeÉèÖÃÊÇ·ñ¿ÉÒÔ±àдtex¡£
ÎÒ´ÓIEEEÄÚÀïÏÂÔØÁËÒ»¸ölatexÄ£°å£¬ÔÚvscodeÄÚÀï¿´¿´Äܲ»¿É±àÒë¡£
ÏÂÔغÃlatexÄ£°åºó£¬
¢Ù °Ñ.texÎļþÍÏÈëvscodeÖÐ
¢Ú µã»÷×ó±ß¹¤¾ßÀ¸µÄTEX°´Å¥
¢Û ÕÒµ½Build LaTex project£¬µãËü£¡ÈôÊDz»±¨´íµÄ»°£¬ÔòÔËÐÐÀֳɡ£ÎÒÒ»Ñùƽ³£»áÑ¡Recipe:pdflatex×÷Ϊ±àÒëÊÖ¶Î
¢Ü ÕÒµ½View LaTex PDF£¬Ñ¡ÔñView in VSCode tab£¬Õâ¸öʱ¼ä¾Í»áÔÚvscodeµÄÒ³ÃæÖзºÆðÌìÉúµÄpdfÁË£¬ÈçÏÂͼÓұ߰×É«ÇøÓòËùʾ¡£
ÒªÊÇÒ»ÇÐÕý³££¬µ½ÕâÀï¾Í¿¢ÊÂÁË¡£
3 LatexÉèÖôúÂë˵Ã÷
ÕâÀïÖ÷ÒªÊÇдһЩÔÚµÚ1.2½ÚÄÚÀïÉèÖôúÂëµÄ˵Ã÷£¬±ÜÃâ×Ô¼ºÒÅÍü¡£
3.1 ±àÒëÏÂÁî
"latex-workshop.latex.tools": [ { "name": "pdflatex", "command": "pdflatex", "args": [ "-synctex=1", "-interaction=nonstopmode", "-file-line-error", "%DOCFILE%" ] }, { "name": "xelatex", "command": "xelatex", "args": [ "-synctex=1", "-interaction=nonstopmode", "-file-line-error", "%DOCFILE%" ] }, { "name": "bibtex", "command": "bibtex", "args": [ "%DOCFILE%" ] }],
µÇ¼ºó¸´ÖÆ
´Ë´¦´úÂëÊÇΪÏÂÃærecipeµÄ±àÒëÁ´Ìṩ±àÒëÏÂÁnameÊDZêÇ©£¬¿É±»recipeÒýÓã¬commandÊDZàÒëÏÂÁî¡£%DOCFILE%ÌåÏÖÎļþ·¾¶¿ÉÒÔΪÖÐÎÄ¡£
3.2 ±àÒëÁ´
"latex-workshop.latex.recipes": [ { "name": "xelatex", "tools": [ "xelatex" ], }, { "name": "pdflatex", "tools": [ "pdflatex" ] }, { "name": "xe->bib->xe->xe", "tools": [ "xelatex", "bibtex", "xelatex", "xelatex" ] }, { "name": "pdf->bib->pdf->pdf", "tools": [ "pdflatex", "bibtex", "pdflatex", "pdflatex" ] }],
µÇ¼ºó¸´ÖÆ
´Ë´¦´úÂë½ç˵Á˱àÒëÁ´£¬¼´Ó¦Æ¾Ö¤Ê²Ã´Ë³ÐòÑ¡Ôñ±àÒëÆ÷±àÒëtexÎļþ£¬nameÊDZêÇ©£¬¼´·ºÆðÔÚ¹¤¾ßÀ¸ÄÚÀïµÄÃû³Æ£¬tool½ç˵ÁËƾ֤ºÎÖÖ˳ÐòʹÓñàÒëÆ÷¡£
3.3 ɨ³ý¸¨ÖúÎļþ
"latex-workshop.latex.clean.fileTypes": [ "*.aux", "*.bbl", "*.blg", "*.idx", "*.ind", "*.lof", "*.lot", "*.out", "*.toc", "*.acn", "*.acr", "*.alg", "*.glg", "*.glo", "*.gls", "*.ist", "*.fls", "*.log", "*.fdb_latexmk"],
µÇ¼ºó¸´ÖÆ
ÉÏÃæµÄ´úÂë½ç˵ÁËҪɨ³ýµÄ¸¨ÖúÎļþµÄÃûÌá£
//ÉèÖÃΪnever²»É¨³ý¸¨ÖúÎļþ"latex-workshop.latex.autoClean.run": "never",
µÇ¼ºó¸´ÖÆ
ÕâÀïÓÐÈý¸öÑ¡Ï»®·ÖÊÇ£º
¢Ù onBuilt£ÔÃĿαàÒëºó¶¼É¨³ý¸¨ÖúÎļþ£»
¢Ú onFailed£º ±àÒëʧ°Üʱɨ³ý¸¨ÖúÎļþ£»
¢Û never£º´Ó²»É¨³ý¸¨ÖúÎļþ¡£
ÎÒÕâÀïÑ¡ÁËnever£¬Ò»×îÏÈÓõÄÊÇonFailed£¬µ«ÎÒ·¢Ã÷Ò»µ©±àÒë¹ýʧ֮ºó£¬vscode»á°ÑËùÓи¨ÖúÎļþËùÓÐɨ³ý£¬µ¼ÖÂÐ޸ĴúÂëÈ¥µôbugÖ®ºó£¬Ò²ÎÞ·¨Õý³£±àÒëÁË£¬ÒÔÊÇÑ¡ÔñÁËnerver¡£
3.4 pdfä¯ÀÀÆ÷Ñ¡Ôñ
//texÎļþä¯ÀÀÆ÷£¬¿ÉÑ¡ÏîΪ"none" "browser" "tab" "external""latex-workshop.view.pdf.viewer": "tab",
µÇ¼ºó¸´ÖÆ
ÉÏÃæ´úÂë½ç˵Á˱àÒëºóÉó²épdfµÄä¯ÀÀÆ÷£¬ÓÐ4¸öÑ¡Ï»®·ÖÊÇ£º
¢Ù none: ²»±Øä¯ÀÀÆ÷£»
¢Ú brower£ºÊ¹ÓÃÍøÒ³ä¯ÀÀÆ÷£»
¢Û tab£ºÊ¹ÓÃvscodeÄÚÖÃä¯ÀÀÆ÷£»
¢Ü external£ºÊ¹ÓÃÍâÖÃpdfä¯ÀÀÆ÷¡£
ÎÒÓõÄÊÇvscodeÄÚÖÃä¯ÀÀÆ÷£¬×ÅʵÍøÒ³ä¯ÀÀÆ÷ҲͦºÃÓõģ¬ÏÔ×Ö´ó¡£
3.5 ×Ô¶¯±àÒëÑ¡Ïî
//×Ô¶¯±àÒëtexÎļþ"latex-workshop.latex.autoBuild.run": "onFileChange",
µÇ¼ºó¸´ÖÆ
ÉÏÃæ´úÂë½ç˵ÁË×Ô¶¯±àÒë´úÂëµÄ¹¦Ð§£¬Ê¹ÓÃĬÈϱàÒëÁ´×Ô¶¯¹¹½¨texµÄproject£¬ÓÐ3¸öÑ¡Ï»®·ÖÊÇ£º
¢Ù onFileChange£º¼ì²âµ½Îļþ¸ü¸ÄµÄʱ¼ä×Ô¶¯±àÒëtex£»
¢Ú onSave£ºÉúÑĵÄʱ¼ä×Ô¶¯±àÒëtex£»
¢Û never£º²»×Ô¶¯±àÒëtex¡£
ÎÒÑ¡ÔñµÄÊÇonFileChange£¬Ê±Ê±±àÒ룬°ü¹Ü×Ô¼ºµÄÎĵµ²»É¥Ê§¡£
3.6 ÏÔʾ²Ëµ¥ÄÚÈÝ
//ÏÔʾÄÚÈݲ˵¥£º£¨1£©±àÒëÎļþ£»£¨2£©¶¨Î»Óαê"latex-workshop.showContextMenu": true,
µÇ¼ºó¸´ÖÆ
ÉÏÃæ´úÂë½ç˵ÁËÔÚtexÎļþÖУ¬µ¥»÷Êó±êÓÒ¼ü·ºÆðµÄ²Ëµ¥Ñ¡Ïî¡£
ÕâÊÇÊôÐÔΪtrueʱÓÒ¼ü²Ëµ¥µÄÑù×Ó¡£
ÕâÊÇÊôÐÔΪfalseʱÓÒ¼ü²Ëµ¥µÄÑù×Ó¡£
Build LaTex projrctΪ±àÒëlatexÏîÄ¿£¬SyncTex from cursorΪ¶¨Î»tex´úÂëÔÚpdfÎļþÖеÄλÖ㬼´ÕýÏò¶¨Î»¡£
ÕâÀïΪÁËÀû±ã±àÒëºÍ¶¨Î»ÕýÎÄÄÚÈÝ£¬ÎÒÑ¡ÁËtrueÑ¡Ïî¡£
3.6 ¹ýʧºÍÖÒÑÔÐÅÏ¢ÌáÐÑ
//ÏÔʾ¹ýʧ"latex-workshop.message.error.show": false,//ÏÔʾÖÒÑÔ"latex-workshop.message.warning.show": false,
µÇ¼ºó¸´ÖÆ
ÉÏÃæ´úÂë½ç˵ÁË·ºÆð¹ýʧ»òÕßÖÒÑÔµÄʱ¼äÊÇ·ñ»á·ºÆ𵯴°£¬ÎÒÒÔΪµ¯´°ºÜ·³ÈË£¬²¢ÇÒÔÚÖÕ¶ËÖÐÒ²¿É¿´µ½£¬ÒÔÊÇÑ¡ÔñÁËfalseÊôÐÔ¡£
3.7 ×Ô¶¯²¹È«¹¦Ð§
//´ÓʹÓõİüÖÐ×Ô¶¯²¹È«ÏÂÁîºÍÇéÐÎ"latex-workshop.intellisense.package.enabled": true,
µÇ¼ºó¸´ÖÆ
ÉÏÃæ´úÂë½ç˵ÁËÊÇ·ñ×Ô¶¯²¹È«ÏÂÁîºÍÇéÐεĹ¦Ð§£¬ÎÒÒÔΪͦÊÊÓõģ¬ÉÙ´òÐí¶à×Ö£¬ÌØÊâÀû±ã£¬ÉÐÓÐÌáÐÑ£¬ÒÔÊÇÑ¡ÔñÁËtrueÊôÐÔ¡£
3.8 ĬÈϱàÒëÁ´Ñ¡Ôñ
//ÉèÖÃvscode±àÒëtexÎĵµÊ±µÄĬÈϱàÒëÁ´"latex-workshop.latex.recipe.default": "lastUsed",
µÇ¼ºó¸´ÖÆ
ÉÏÃæ´úÂëÉèÖÃÁËvscode±àÒëtexÎĵµÖеÄĬÈϱàÒëÁ´£¬ÓÐ2¸öÑ¡Ï»®·ÖÊÇ
¢Ù first£ºÑ¡Ôñlatex-workshop.latex.recipesµÄµÚ1Ìõ×÷ΪĬÈϱàÒëÁ´£»
¢Ú lastUsed£ºÑ¡ÔñÉÏÒ»´ÎʹÓõıàÒëÁ´×÷ΪĬÈϱàÒëÁ´¡£
ÎÒÔÚÕâÀïÑ¡ÔñÁËlastUsed£¬ÓÉÓÚÎÒ·¢Ã÷ÎÒÓõÄ×î¶àµÄ±àÒëÁ´ÊÇpdflatex¡£
3.9 ·´Ïò¶¨Î»
// ÓÃÓÚ·´Ïòͬ²½µÄÄÚ²¿Éó²éÆ÷µÄ¼ü°ó¶¨¡£ctrl/cmd +µã»÷(ĬÈÏ)»òË«»÷ "latex-workshop.view.pdf.internal.synctex.keybinding": "double-click",
µÇ¼ºó¸´ÖÆ
ÉÏÃæ´úÂë½ç˵ÁË´Ópdfä¯ÀÀÆ÷Öж¨Î»vscodeµÄtex´úÂëλÖõĹ¦Ð§£¬ÎÒÒÔΪÕâÌõ¹¦Ð§Ê®·ÖÊ®·ÖºÃÓã¬Ç¿ÁÒÍƼö£¡
ÕâÀïÒ²ÓÐ2¸öÑ¡Ï»®·ÖÊÇ£º
¢Ù ctrl-click£ºctrl+Êó±ê×ó¼üµ¥»÷£»
¢Ú double-click£ºÊó±ê×ó¼üË«»÷¡£
ÎÒ½ÏÁ¿Ï²»¶Êó±ê×ó¼üË«»÷£¬ÒÔÊÇÑ¡ÔñµÄµÚ¶þ¸öÑ¡Ïî¡£
¸ü¶à¹ØÓÚVSCodeµÄÏà¹Ø֪ʶ£¬Çë»á¼û£ºvscode»ù´¡½Ì³Ì£¡
ÒÔÉϾÍÊÇÊÖ°ÑÊÖ´øÄãÔÚvscodeÖÐÉèÖÃlatexµÄÏêϸÄÚÈÝ£¬¸ü¶àÇë¹Ø×¢±¾ÍøÄÚÆäËüÏà¹ØÎÄÕ£¡