Skip to content
Snippets Groups Projects
Commit df1fdfa4 authored by Fredrik Hübinette (Hubbe)'s avatar Fredrik Hübinette (Hubbe)
Browse files

bugfix, plus now reports length of longest line..

Rev: tutorial/latex.pike:1.3
parent ffaae05f
No related branches found
No related tags found
No related merge requests found
...@@ -32,7 +32,7 @@ string low_latex_quote(string text) ...@@ -32,7 +32,7 @@ string low_latex_quote(string text)
string latex_quote(string text) string latex_quote(string text)
{ {
return low_latex_quote( pre ? text : ((text/"\n") - ({""})) *"" ); return low_latex_quote( pre ? text : ((text/"\n") - ({""})) *"\n" );
} }
...@@ -347,13 +347,19 @@ string convert_to_latex(SGML data, void|int flags) ...@@ -347,13 +347,19 @@ string convert_to_latex(SGML data, void|int flags)
ret+="\\verb+ +"; ret+="\\verb+ +";
break; break;
case "ex_br": case "ex_br":
case "br": case "br":
int e=strlen(ret)-1; if(pre)
while(e>=0 && ret[e]==' ') e--; {
if(e<0 || ret[e]=='\n') ret+="\n";
ret=ret[..e]+"\n"; }else{
else int e=strlen(ret)-1;
ret+="\\\\"; while(e>=0 && ret[e]==' ') e--;
if(e<0 || ret[e]=='\n')
ret=ret[..e]+"\n";
else
ret+="\\\\";
}
break; break;
case "p": case "p":
...@@ -386,9 +392,9 @@ string convert_to_latex(SGML data, void|int flags) ...@@ -386,9 +392,9 @@ string convert_to_latex(SGML data, void|int flags)
replace(latex_quote(href), replace(latex_quote(href),
({".","/",":"}), ({".","/",":"}),
({ ({
".\\discretionary{}{}{}", "\\discretionary{}{}{}.",
"/\\discretionary{}{}{}", "\\discretionary{}{}{}/",
":\\discretionary{}{}{}", "\\discretionary{}{}{}:",
}))+ }))+
"}"; "}";
} }
...@@ -523,4 +529,6 @@ void output(string base, WMML data) ...@@ -523,4 +529,6 @@ void output(string base, WMML data)
"\\end{document}\n"; "\\end{document}\n";
rm(base+".tex"); rm(base+".tex");
Stdio.write_file(base+".tex",x); Stdio.write_file(base+".tex",x);
werror("Longest line is %d characters.\n",sort(Array.map(x/"\n",strlen))[-1]);
} }
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment