代码拉取完成,页面将自动刷新
同步操作将从 连享会/eda 强制同步,此操作会覆盖自 Fork 仓库以来所做的任何修改,且无法恢复!!!
确定后同步将在后台操作,完成时将刷新页面,请耐心等待。
********************************************************************************
* Description of the Program - *
* Utility to build a LaTeX compilation script. *
* *
* Program Output - *
* Bash/Batch script calling pdflatex on a given LaTeX source code file *
* *
* Lines - *
* 125 *
* *
********************************************************************************
*! maketexcomp
*! v 0.0.5
*! 01may2019
// Drop program from memory if it is already loaded
cap prog drop maketexcomp
// Define program
prog def maketexcomp, rclass
// Version Stata should use to interpret the code
version 14
// Define syntax structure for subroutine
syntax anything(name=filenm id="Name of LaTeX Source Code File"), ///
SCRiptname(string) root(string) [ PDFlatex(string asis) ]
// If path to pdfLaTeX not specified use *nix binary reference
if `"`pdflatex'"' == "" loc pdflatex pdflatex
// Clean the filename macro to remove any quotation marks from the path
loc filenm `: subinstr loc filenm `"""' "", all'
// Check if user is running on Windows
if `"`c(os)'"' == "Windows" {
// Creates file extension for Windows terminal executables
loc extension .bat
// Adds a comment header for Windows batch files
loc header "::Batch file to compile LaTeX source"
// Move to directory
loc dirmove `"chdir /d `root'"'
// Contructs the reference to the pdf LaTeX binary
loc bin `pdflatex'.exe
// Contructs the reference to the terminal command to delete/remove files
loc remove DEL
// Only used for parallel construction across OS
loc scriptexec
} // End of IF Block for Windows systems
// For *nix based systems
else {
// Create extension reference for a shell script
loc extension .sh
// Add the header for the Bourne Again SHell
loc header "#!/bin/bash"
// Move to directory
loc dirmove `"cd `root'"'
// Add reference to the binary for pdf LaTeX
loc bin `pdflatex'
// Add reference for the terminal command to delete/remove files
loc remove "rm"
// Constructs shell command to make the script executable
loc scriptexec ! chmod +x "`scriptname'`extension'"
} // End of ELSE Block for *nix based systems
// Opens a file connection to construct the compilation script
file open comp using `"`scriptname'`extension'"', w replace
// Writes the appropriate OS header for a terminal script
file write comp "`header'" _n
// Writes the command to move into the directory where the executable is located
file write comp "`dirmove'" _n
// Calls pdfLaTeX to do the first pass
file write comp `"`bin' "`filenm'.tex""' _n
// Calls pdfLaTeX to do the second pass; this should finalize hyperrefs to
// individual graphs and TOC references as well as doing the initial insert
// and build of the TOC
file write comp `"`bin' "`filenm'.tex""' _n
// Calls pdfLaTeX to do the last pass; this should finalize the TOC/TOF and
// any other references like that
file write comp `"`bin' "`filenm'.tex""' _n
// Loop over ancillary file extensions
foreach v in aux lof log lot out toc {
// If Windows these file name references need to have a Windows path
// delimiter
if `"`c(os)'"' == "Windows" loc filenm `: subinstr loc filenm "/" "\", all'
// Delete ancillary files
file write comp `"`remove' "`filenm'.`v'""' _n
} // End Loop over ancillary file extensions
// Adds empty line
file write comp "" _n
// Adds empty line
file write comp "" _n
// Closes the open file connection
file close comp
// Need to make the file executable on *nix systems
`scriptexec'
// Return shell command to execute compilation script on OSX
if `"`c(os)'"' == "MacOSX" ret loc comp ! open -a Terminal.app `scriptname'`extension'
// For other OS
else ret loc comp ! `scriptname'`extension'
// End of subroutine definition
end
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。