remove label. skip CD env

This commit is contained in:
Takashi Tamura 2018-10-10 08:31:41 +09:00
parent c34cd42b87
commit 3f830124a1
2 changed files with 7 additions and 5 deletions

View File

@ -82,9 +82,10 @@ const setMathInDiv = function (divid, tmpid) {
const setVSCodeForegroundColor = function(tex) {
const rgb = getVSCodeEditorForegound();
const color = '\\color[RGB]{' + rgb[0] + ',' + rgb[1] + ',' + rgb[2] + '}'
const ret = tex.replace(/^(\$|\\\(|\\begin{.*?})/, '$1' + color);
return ret.replace(/(&|\\\\)/g, '$1' + color);
const color = '\\color[RGB]{' + rgb[0] + ',' + rgb[1] + ',' + rgb[2] + '}';
var ret = tex.replace(/^(\$|\\\(|\\begin{.*?}({.*?})*)/, '$1' + color);
ret = ret.replace(/(\\begin{CD}[\s\S]*?\\end{CD}|((?:\\[^\\]|[^&\\])*&+|\\\\))/g, '$1' + color);
return ret;
}
window.addEventListener('message', event => {

View File

@ -67,9 +67,10 @@ export class HoverProvider implements vscode.HoverProvider {
}
private mathjaxify_tex(tex: string, envname: string) : string {
const ret = tex.replace(/^\s*%.*?\r?\n/mg, '')
let ret = tex.replace(/^\s*%.*?\r?\n/mg, '')
ret = ret.replace(/\\label\{.*?\}/g, '')
if (envname.match(/^(aligned|alignedat|array|Bmatrix|bmatrix|cases|CD|gathered|matrix|pmatrix|smallmatrix|split|subarray|Vmatrix|vmatrix)$/)) {
return '\\begin{equation}' + ret + '\\end{equation}'
ret = '\\begin{equation}' + ret + '\\end{equation}'
}
return ret
}