tex-button
実験的なものですので,コードが頻繁に更新されます.お手数ですが,最新版をコピペしてご利用ください.
https://gyazo.com/4e57f815fc6dc2e54336399c6e9d109a
ここでプリアンブルなどを設定できます
code:button.js
var PERIOD = '.';
var today = new Date();
var titlePage = false;
var head = [
'\\usepackagedvipdfmx{graphicx, color}', '\\usepackage{layout}',
'\\usepackage{amssymb}',
'\\usepackage{amsmath}',
'\\author{daiiz}',
\\date{${today.toLocaleDateString()}},
];
window.PROXY = '';
window.PORT = 8102;
これ以降のコードは編集しないでください
code:button.js
c.document.close()}},escapeHtml=function(d){d=d.replace(/&/g,"&");d=d.replace(/</g,"<");d=d.replace(/>/g,">");d=d.replace(/"/g,""");return d=d.replace(/'/g,"'")};
(function(){console.clear();for(var d="",k="",f=0,c=0,r=[],g="",h="",A=function(e){e=void 0===e?0:e;for(var a=h+" ",b=1;b<e;b++)a+=" ";return a},x=function(e){e=void 0===e?0:e;0>e&&(e=0);var a=!1;for(2<=c-e&&(a=!0);a&&1<=c-e;){for(var b=h,w=1;w<Math.min(f,c);w++)b+=" ";g.push(b+"\\end{itemize}");--c}f=c;c=e;returnf,c},y=function(){if(f!==c){for(var e=h,a=1;a<Math.max(f,c);a++)e+=" ";f<c&&g.push(e+"\\begin{itemize}");f>c&&g.push(e+"\\end{itemize}")}},B=function(e){e=void 0===e?1:e;return 1=== e?"\\subsubsection":2===e?(h=" ","\\subsection"):3===e?(h=" ","\\section"):""},C=function(e){e=void 0===e?"":e;var a=document.createElement("div");a.innerHTML=e;e=a.querySelectorAll("strong");for(var b=0;b<e.length;b++){var c=eb,d=+c.className.split("level-")1,l=c.innerHTML;c.innerHTML=B(d)+"{"+l+"}"}return a.innerHTML},D=function(e){for(var a=e.querySelectorAll(".formula"),b=0;b<a.length;b++){var c=ab,d=c.querySelector("annotation");c.innerHTML=" $"+d.innerHTML+"$ "}return e},E=function(a){a= void 0===a?"":a;var b=document.createElement("div");b.innerHTML=a;a=b.querySelectorAll("a");for(var c=0;c<a.length;c++){var d=ac,q=d.innerText.trim(),l=d.href,f=q;"hashTag"===d.type&&(f="");q=d.querySelector("img");if(null!==q)if(q.classList.contains("icon"))f="";else{var l=l.split("/"),k=ll.length-1.split("?"),l="width=0.9\\linewidth",g="";2===k.length&&(l="[width="+k1+"]");0<q.src.indexOf("gyazo.com/")&&(g=q.src.split("gyazo.com/")1,g=g.split("/")0.split(".")0);0<g.length&&(f=window.decodeURIComponent(k0), f=[/*h+("%%IMAGE; "+g+"; "+q.src),*/h+"\\begin{figure}h!",h+" \\begin{center}",h+(" \\includegraphics"+l+"{"+("./gyazos/"+g+".png")+"}"),h+(" \\caption{"+f+"}"),h+" \\end{center}",h+"\\end{figure}"].join("\n"))}d.innerText=f}return b.innerText},t=function(){var a=r.join("");0<r.length&&0<a.trim().length&&(g.push(h+a),g.push(""),r=[])},m=document.querySelector(".lines").cloneNode(!0),m=function(a){for(var b=a.querySelectorAll("div.table-block"),c=0;c<b.length;c++){var d=$(bc);d.find(".line").removeClass("line"); d.find(".indent-mark").remove();d.addClass("line");var f=["\\begin{table}htb"," \\begin{center}"],g=d.find(".table-block-start").text(),g=" \\caption{"+g+"}";f.push(g);f.push(" \\begin{tabular}{|l|l|l|l|} \\hline");for(var g=d.find("tr"),k=0;k<g.length;k++){for(var h=$(gk).find("td"),m=[],n=0;n<h.length;n++){var p=$(hn).text().trim();0<p.length&&m.push(p)}h=" "+m.join(" & ");h+=" \\\\";0===k&&(h+=" \\hline \\hline");k===g.length-1&&(h+=" \\hline");f.push(h)}f.push(" \\end{tabular}"); f.push(" \\end{center}");f.push("\\end{table}");d.html('<div class="text">'+f.join("\n")+"</div>")}return a}(m),m=m.querySelectorAll(".line"),u=!1,z=0,n=1;n<m.length;n++){var b=mn.querySelector(".text"),a=b.querySelector('img.iconsrc="/api/pages/icons/hr/icon"');if(u&&a)break;if(a)u=!0;else if(u){for(var p=b.querySelectorAll("span.empty-char-index"),a=0;a<p.length;a++){var v=pa;v.innerText=""}p=b.querySelectorAll("span.backquote");for(a=0;a<p.length;a++)v=pa,v.innerText=0===a%2?"{\\tt ": "}";b=D(b);a=b.innerHTML.replace(/<span>/g,"");a=a.replace(/<span.+?>/g,"").replace(/<\/span>/g,"");a=a.replace(/<br.+?>/g,"");a=a.replace(/\n/gi,"").replace(/\t/gi,"").trim();a=C(a);a=E(a);a=a.trim();0===d.length?(d=a,z=n):(b=b.querySelector(".indent-mark"),null!==b&&(b=+b.style.width.split("em")0/1.5,a=A(b)+"\\item "+a,x(b)),n===z+1&&a.trim().startsWith("\\item")?(k=a.split("\\item ")1.trim(),c=f=0):(b=a.trim(),b.startsWith("\\item")||x(0),b.startsWith("\\")?(t(),b.startsWith("\\section")|| b.startsWith("\\subsection")||b.startsWith("\\subsubsection")?(b.startsWith("\\subsection")&&(a=" "+a),b.startsWith("\\subsubsection")&&(a=" "+a),0<gg.length-1.length&&g.push("")):a=h+a,y(),g.push(a)):(y(),0<b.length&&!b.startsWith("%")?b.endsWith(".")||b.endsWith("\uff0e")||b.endsWith("\u3002")||(b+=PERIOD):t(),r.push(b))))}}t();var abstractBox="\\begin{abstract}"," "+k,"\\end{abstract}";head.push("\\title{"+d+"}");head.push("\\begin{document}");0<k.length&&head.push(abstractBox.join("\n")); head.push(" \\maketitle");titlePage&&head.push(" \\clearpage");g.forEach(function(a){head.push(a)});head.push("\\end{document}");writer(d,head,window.PORT)})();