代码拉取完成,页面将自动刷新
同步操作将从 连享会/eda 强制同步,此操作会覆盖自 Fork 仓库以来所做的任何修改,且无法恢复!!!
确定后同步将在后台操作,完成时将刷新页面,请耐心等待。
********************************************************************************
* Description of the Program - *
* Utility for handling LaTeX spcial characters. The ref option is used when *
* string will be used as part of a reference label in LaTeX (e.g., special *
* characters are deleted); without this option the characters are escaped *
* and/or their text macros used in their place. *
* *
* Program Output - *
* r(clntex) - A LaTeX sanitized string *
* *
* Lines - *
* 101 *
* *
********************************************************************************
*! texclean
*! v 0.0.2
*! 03may2019
// Drop program from memory if previously loaded
cap prog drop texclean
// Define program
prog def texclean, rclass
// Set version used to interpret code
version 14
// Set program syntax
syntax anything(name=text id="LaTeX String to Escape" everything), [ Ref ]
// Check for LaTeX special characters
if regexm(`"`text'"', "([#\$%&~_\^\\\{\}<>\|¡¿£])") == 1 {
// Store argument in new local macro
loc cln `"`text'"'
// For use with reference labels
if "`ref'" != "" {
// Loop over the LaTeX special characters
foreach c in "£" "|" "¡" "¿" "{" "}" "<" ">" "\" "^" "_" "~" "&" ///
"%" "$" "#" {
// Remove the special characters
loc cln `: subinstr loc cln `"`c'"' "", all'
} // End Loop over LaTeX special characters
} // End IF Block for reference strings
// Otherwise
else {
// Handle \ character
loc cln `: subinstr loc cln "\" "\\", all'
// Handle # character
loc cln `: subinstr loc cln "#" "\#", all'
// Handle $ character
loc cln `: subinstr loc cln "$" "\$", all'
// Handle % character
loc cln `: subinstr loc cln "%" "\%", all'
// Handle & character
loc cln `: subinstr loc cln "&" "\&", all'
// Handle ~ character
loc cln `: subinstr loc cln "~" "\textasciitilde{}", all'
// Handle _ character
loc cln `: subinstr loc cln "_" "\_", all'
// Handle ^ character
loc cln `: subinstr loc cln "^" "\textasciicircum{}", all'
// Handle { character
loc cln `: subinstr loc cln `"{"' `"\{"', all'
// Handle } character
loc cln `: subinstr loc cln `"}"' `"\}"', all'
} // End ELSE Block for non reference label cases
// Return the cleaned string
ret loc clntex `cln'
} // End IF Block for cases w/LaTeX special characters
// If no special characters are in the string
else {
// Return string that does not include special characters
ret loc clntex `text'
} // End ELSE Block for text w/o special characters
// End Program definition
end
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。