--- loncom/interface/lonprintout.pm 2002/09/09 19:27:42 1.57 +++ loncom/interface/lonprintout.pm 2004/01/15 21:23:22 1.270 @@ -1,7 +1,7 @@ # The LearningOnline Network # Printout # -# $Id: lonprintout.pm,v 1.57 2002/09/09 19:27:42 sakharuk Exp $ +# $Id: lonprintout.pm,v 1.270 2004/01/15 21:23:22 sakharuk Exp $ # # Copyright Michigan State University Board of Trustees # @@ -25,17 +25,6 @@ # # http://www.lon-capa.org/ # -# (Internal Server Error Handler -# -# (Login Screen -# 5/21/99,5/22,5/25,5/26,5/31,6/2,6/10,7/12,7/14, -# 1/14/00,5/29,5/30,6/1,6/29,7/1,11/9 Gerd Kortemeyer) -# -# 3/1/1 Gerd Kortemeyer) -# -# 3/1 Gerd Kortemeyer -# -# 9/17 Alex Sakharuk # package Apache::lonprintout; @@ -48,926 +37,1853 @@ use Apache::inputtags; use Apache::grades; use Apache::edit; use Apache::File(); +use Apache::lonnavmaps; +use Apache::lonratedt; use POSIX qw(strftime); +use Apache::lonlocal; +use GDBM_File; -sub headerform { - my $r = shift; - $r->print(< - -LON-CAPA output for printing - - -
-$ENV{'form.postdata'}

-ENDHEADER +my %hash; +my $LaTeXwidth = 0; + + +sub latex_header_footer_remove { + my $text = shift; + $text =~ s/\\end{document}//; + $text =~ s/\\documentclass([^&]*)\\begin{document}//; + return $text; } -sub menu_for_output { - my $r = shift; - $r->print(<What do you want to print? Make a choice.
- - - Current document -(you will print what you see on the screen)
-ENDMENUOUT1 - if ((not $ENV{'request.role'}=~m/^au\./) and (not $ENV{'request.role'}=~m/^ca\./)) { - $r->print(< All problems from the primary sequence
- The whole primary sequence (problems plus all html and xml files)
- All problems from the top level sequence
-
-ENDMENUOUT2 - } - if ($ENV{'request.role'}=~m/^cc\./ or $ENV{'request.role'}=~m/^in\./ or $ENV{'request.role'}=~m/^ta\./) { - $r->print(< Print assignment (all problems from the primary sequence) for group of students

-ENDMENUOUT6 - } - my $subdirtoprint = &Apache::lonnet::filelocation("",$ENV{'form.url'}); - $subdirtoprint =~ s/\/[^\/]+$//; - if (&Apache::lonnet::allowed('bre',$subdirtoprint) eq 'F') { - $r->print(< All problems from current subdirectory (where this particular problem is)
-ENDMENUOUT4 - } - $r->print(<



-

And what page format do you prefer?

- - - - - - -
- Landscape
- Portrait
-
  - Number of columns: -
-
- -ENDMENUOUT5 +sub character_chart { + my $result = shift; + $result =~ s/&\#0?0?(7|9);//g; + $result =~ s/&\#0?(10|13);//g; + $result =~ s/&\#0?32;/ /g; + $result =~ s/&\#0?33;/!/g; + $result =~ s/&(\#0?34|quot);/\"/g; + $result =~ s/&\#0?35;/\\\#/g; + $result =~ s/&\#0?36;/\\\$/g; + $result =~ s/&\#0?37;/\\%/g; + $result =~ s/&(\#0?38|amp);/\\&/g; + $result =~ s/&\#(0?39|146);/\'/g; + $result =~ s/&\#0?40;/(/g; + $result =~ s/&\#0?41;/)/g; + $result =~ s/&\#0?42;/\*/g; + $result =~ s/&\#0?43;/\+/g; + $result =~ s/&\#(0?44|130);/,/g; + $result =~ s/&\#0?45;/-/g; + $result =~ s/&\#0?46;/\./g; + $result =~ s/&\#0?47;/\//g; + $result =~ s/&\#0?48;/0/g; + $result =~ s/&\#0?49;/1/g; + $result =~ s/&\#0?50;/2/g; + $result =~ s/&\#0?51;/3/g; + $result =~ s/&\#0?52;/4/g; + $result =~ s/&\#0?53;/5/g; + $result =~ s/&\#0?54;/6/g; + $result =~ s/&\#0?55;/7/g; + $result =~ s/&\#0?56;/8/g; + $result =~ s/&\#0?57;/9/g; + $result =~ s/&\#0?58;/:/g; + $result =~ s/&\#0?59;/;/g; + $result =~ s/&(\#0?60|lt|\#139);/\$<\$/g; + $result =~ s/&\#0?61;/\$=\$/g; + $result =~ s/&(\#0?62|gt|\#155);/\$>\$/g; + $result =~ s/&\#0?63;/\?/g; + $result =~ s/&\#0?65;/A/g; + $result =~ s/&\#0?66;/B/g; + $result =~ s/&\#0?67;/C/g; + $result =~ s/&\#0?68;/D/g; + $result =~ s/&\#0?69;/E/g; + $result =~ s/&\#0?70;/F/g; + $result =~ s/&\#0?71;/G/g; + $result =~ s/&\#0?72;/H/g; + $result =~ s/&\#0?73;/I/g; + $result =~ s/&\#0?74;/J/g; + $result =~ s/&\#0?75;/K/g; + $result =~ s/&\#0?76;/L/g; + $result =~ s/&\#0?77;/M/g; + $result =~ s/&\#0?78;/N/g; + $result =~ s/&\#0?79;/O/g; + $result =~ s/&\#0?80;/P/g; + $result =~ s/&\#0?81;/Q/g; + $result =~ s/&\#0?82;/R/g; + $result =~ s/&\#0?83;/S/g; + $result =~ s/&\#0?84;/T/g; + $result =~ s/&\#0?85;/U/g; + $result =~ s/&\#0?86;/V/g; + $result =~ s/&\#0?87;/W/g; + $result =~ s/&\#0?88;/X/g; + $result =~ s/&\#0?89;/Y/g; + $result =~ s/&\#0?90;/Z/g; + $result =~ s/&\#0?91;/[/g; + $result =~ s/&\#0?92;/\$\\setminus\$/g; + $result =~ s/&\#0?93;/]/g; + $result =~ s/&\#(0?94|136);/\$\\wedge\$/g; + $result =~ s/&\#(0?95|138|154);/\\underline{\\makebox[2mm]{\\strut}}/g; + $result =~ s/&\#(0?96|145);/\`/g; + $result =~ s/&\#0?97;/a/g; + $result =~ s/&\#0?98;/b/g; + $result =~ s/&\#0?99;/c/g; + $result =~ s/&\#100;/d/g; + $result =~ s/&\#101;/e/g; + $result =~ s/&\#102;/f/g; + $result =~ s/&\#103;/g/g; + $result =~ s/&\#104;/h/g; + $result =~ s/&\#105;/i/g; + $result =~ s/&\#106;/j/g; + $result =~ s/&\#107;/k/g; + $result =~ s/&\#108;/l/g; + $result =~ s/&\#109;/m/g; + $result =~ s/&\#110;/n/g; + $result =~ s/&\#111;/o/g; + $result =~ s/&\#112;/p/g; + $result =~ s/&\#113;/q/g; + $result =~ s/&\#114;/r/g; + $result =~ s/&\#115;/s/g; + $result =~ s/&\#116;/t/g; + $result =~ s/&\#117;/u/g; + $result =~ s/&\#118;/v/g; + $result =~ s/&\#119;/w/g; + $result =~ s/&\#120;/x/g; + $result =~ s/&\#121;/y/g; + $result =~ s/&\#122;/z/g; + $result =~ s/&\#123;/\\{/g; + $result =~ s/&\#124;/\|/g; + $result =~ s/&\#125;/\\}/g; + $result =~ s/&\#126;/\~/g; + $result =~ s/&\#131;/\\textflorin /g; + $result =~ s/&\#132;/\"/g; + $result =~ s/&\#133;/\$\\ldots\$/g; + $result =~ s/&\#134;/\$\\dagger\$/g; + $result =~ s/&\#135;/\$\\ddagger\$/g; + $result =~ s/&\#137;/\\textperthousand /g; + $result =~ s/&\#140;/{\\OE}/g; + $result =~ s/&\#147;/\`\`/g; + $result =~ s/&\#148;/\'\'/g; + $result =~ s/&\#149;/\$\\bullet\$/g; + $result =~ s/&\#150;/--/g; + $result =~ s/&\#151;/---/g; + $result =~ s/&\#152;/\$\\sim\$/g; + $result =~ s/&\#153;/\\texttrademark /g; + $result =~ s/&\#156;/\\oe/g; + $result =~ s/&\#159;/\\\"Y/g; + $result =~ s/&(\#160|nbsp);//g; + $result =~ s/&(\#161|iexcl);/!\`/g; + $result =~ s/&(\#162|cent);/\\textcent /g; + $result =~ s/&(\#163|pound);/\\pounds /g; + $result =~ s/&(\#164|curren);/\\textcurrency /g; + $result =~ s/&(\#165|yen);/\\textyen /g; + $result =~ s/&(\#166|brvbar);/\\textbrokenbar /g; + $result =~ s/&(\#167|sect);/\\textsection /g; + $result =~ s/&(\#168|uml);/\\texthighdieresis /g; + $result =~ s/&(\#169|copy);/\\copyright /g; + $result =~ s/&(\#170|ordf);/\\textordfeminine /g; + $result =~ s/&(\#172|not);/\$\\neg\$/g; + $result =~ s/&(\#173|shy);/ - /g; + $result =~ s/&(\#174|reg);/\\textregistered /g; + $result =~ s/&(\#175|macr);/\$^{-}\$/g; + $result =~ s/&(\#176|deg);/\$^{\\circ}\$/g; + $result =~ s/&(\#177|plusmn);/\$\\pm\$/g; + $result =~ s/&(\#178|sup2);/\$^2\$/g; + $result =~ s/&(\#179|sup3);/\$^3\$/g; + $result =~ s/&(\#180|acute);/\\textacute /g; + $result =~ s/&(\#181|micro);/\$\\mu\$/g; + $result =~ s/&(\#182|para);/\\P/g; + $result =~ s/&(\#183|middot);/\$\\cdot\$/g; + $result =~ s/&(\#184|cedil);/\\c{\\strut}/g; + $result =~ s/&(\#185|sup1);/\$^1\$/g; + $result =~ s/&(\#186|ordm);/\\textordmasculine /g; + $result =~ s/&(\#188|frac14);/\\textonequarter /g; + $result =~ s/&(\#189|frac12);/\\textonehalf /g; + $result =~ s/&(\#190|frac34);/\\textthreequarters /g; + $result =~ s/&(\#191|iquest);/?\`/g; + $result =~ s/&(\#192|Agrave);/\\\`{A}/g; + $result =~ s/&(\#193|Aacute);/\\\'{A}/g; + $result =~ s/&(\#194|Acirc);/\\^{A}/g; + $result =~ s/&(\#195|Atilde);/\\~{A}/g; + $result =~ s/&(\#196|Auml);/\\\"{A}/g; + $result =~ s/&(\#197|Aring);/{\\AA}/g; + $result =~ s/&(\#198|AElig);/{\\AE}/g; + $result =~ s/&(\#199|Ccedil);/\\c{c}/g; + $result =~ s/&(\#200|Egrave);/\\\`{E}/g; + $result =~ s/&(\#201|Eacute);/\\\'{E}/g; + $result =~ s/&(\#202|Ecirc);/\\^{E}/g; + $result =~ s/&(\#203|Euml);/\\\"{E}/g; + $result =~ s/&(\#204|Igrave);/\\\`{I}/g; + $result =~ s/&(\#205|Iacute);/\\\'{I}/g; + $result =~ s/&(\#206|Icirc);/\\^{I}/g; + $result =~ s/&(\#207|Iuml);/\\\"{I}/g; + $result =~ s/&(\#209|Ntilde);/\\~{N}/g; + $result =~ s/&(\#210|Ograve);/\\\`{O}/g; + $result =~ s/&(\#211|Oacute);/\\\'{O}/g; + $result =~ s/&(\#212|Ocirc);/\\^{O}/g; + $result =~ s/&(\#213|Otilde);/\\~{O}/g; + $result =~ s/&(\#214|Ouml);/\\\"{O}/g; + $result =~ s/&(\#215|times);/\$\\times\$/g; + $result =~ s/&(\#216|Oslash);/{\\O}/g; + $result =~ s/&(\#217|Ugrave);/\\\`{U}/g; + $result =~ s/&(\#218|Uacute);/\\\'{U}/g; + $result =~ s/&(\#219|Ucirc);/\\^{U}/g; + $result =~ s/&(\#220|Uuml);/\\\"{U}/g; + $result =~ s/&(\#221|Yacute);/\\\'{Y}/g; + $result =~ s/&(\#223|szlig);/\\ss/g; + $result =~ s/&(\#224|agrave);/\\\`{a}/g; + $result =~ s/&(\#225|aacute);/\\\'{a}/g; + $result =~ s/&(\#226|acirc);/\\^{a}/g; + $result =~ s/&(\#227|atilde);/\\~{a}/g; + $result =~ s/&(\#228|auml);/\\\"{a}/g; + $result =~ s/&(\#229|aring);/{\\aa}/g; + $result =~ s/&(\#230|aelig);/{\\ae}/g; + $result =~ s/&(\#231|ccedil);/\\c{c}/g; + $result =~ s/&(\#232|egrave);/\\\`{e}/g; + $result =~ s/&(\#233|eacute);/\\\'{e}/g; + $result =~ s/&(\#234|ecirc);/\\^{e}/g; + $result =~ s/&(\#235|euml);/\\\"{e}/g; + $result =~ s/&(\#236|igrave);/\\\`{i}/g; + $result =~ s/&(\#237|iacute);/\\\'{i}/g; + $result =~ s/&(\#238|icirc);/\\^{i}/g; + $result =~ s/&(\#239|iuml);/\\\"{i}/g; + $result =~ s/&(\#240|eth);/\$\\partial\$/g; + $result =~ s/&(\#241|ntilde);/\\~{n}/g; + $result =~ s/&(\#242|ograve);/\\\`{o}/g; + $result =~ s/&(\#243|oacute);/\\\'{o}/g; + $result =~ s/&(\#244|ocirc);/\\^{o}/g; + $result =~ s/&(\#245|otilde);/\\~{o}/g; + $result =~ s/&(\#246|ouml);/\\\"{o}/g; + $result =~ s/&(\#247|divide);/\$\\div\$/g; + $result =~ s/&(\#248|oslash);/{\\o}/g; + $result =~ s/&(\#249|ugrave);/\\\`{u}/g; + $result =~ s/&(\#250|uacute);/\\\'{u}/g; + $result =~ s/&(\#251|ucirc);/\\^{u}/g; + $result =~ s/&(\#252|uuml);/\\\"{u}/g; + $result =~ s/&(\#253|yacute);/\\\'{y}/g; + $result =~ s/&(\#255|yuml);/\\\"{y}/g; + $result =~ s/&\#952;/\$\\theta\$/g; +#Greek Alphabet + $result =~ s/&(alpha|\#945);/\$\\alpha \$/g; + $result =~ s/&(beta|\#946);/\$\\beta \$/g; + $result =~ s/&(gamma|\#947);/\$\\gamma \$/g; + $result =~ s/&(delta|\#948);/\$\\delta \$/g; + $result =~ s/&(epsilon|\#949);/\$\\epsilon \$/g; + $result =~ s/&(zeta|\#950);/\$\\zeta \$/g; + $result =~ s/&(eta|\#951);/\$\\eta \$/g; + $result =~ s/&(theta|\#952);/\$\\theta \$/g; + $result =~ s/&(iota|\#953);/\$\\iota \$/g; + $result =~ s/&(kappa|\#954);/\$\\kappa \$/g; + $result =~ s/&(lambda|\#955);/\$\\lambda \$/g; + $result =~ s/&(mu|\#956);/\$\\mu \$/g; + $result =~ s/&(nu|\#957);/\$\\nu \$/g; + $result =~ s/&(xi|\#958);/\$\\xi \$/g; + $result =~ s/&(omicron|\#959);/o/g; + $result =~ s/&(pi|\#960);/\$\\pi \$/g; + $result =~ s/&(rho|\#961);/\$\\rho \$/g; + $result =~ s/&(sigma|\#963);/\$\\sigma \$/g; + $result =~ s/&(tau|\#964);/\$\\tau \$/g; + $result =~ s/&(upsilon|\#965);/\$\\upsilon \$/g; + $result =~ s/&(phi|\#966);/\$\\phi \$/g; + $result =~ s/&(chi|\#967);/\$\\chi \$/g; + $result =~ s/&(psi|\#968);/\$\\psi \$/g; + $result =~ s/&(omega|\#969);/\$\\omega \$/g; + $result =~ s/&(thetasym|\#977);/\$\\vartheta \$/g; + $result =~ s/&(piv|\#982);/\$\\varpi \$/g; + $result =~ s/&(Alpha|\#913);/A/g; + $result =~ s/&(Beta|\#914);/B/g; + $result =~ s/&(Gamma|\#915);/\$\\Gamma \$/g; + $result =~ s/&(Delta|\#916);/\$\\Delta \$/g; + $result =~ s/&(Epsilon|\#917);/E/g; + $result =~ s/&(Zeta|\#918);/Z/g; + $result =~ s/&(Eta|\#919);/H/g; + $result =~ s/&(Theta|\#920);/\$\\Theta \$/g; + $result =~ s/&(Iota|\#921);/I/g; + $result =~ s/&(Kappa|\#922);/K/g; + $result =~ s/&(Lambda|\#923);/\$\\Lambda \$/g; + $result =~ s/&(Mu|\#924);/M/g; + $result =~ s/&(Nu|\#925);/N/g; + $result =~ s/&(Xi|\#926);/\$\\Xi \$/g; + $result =~ s/&(Omicron|\#927);/O/g; + $result =~ s/&(Pi|\#928);/\$\\Pi \$/g; + $result =~ s/&(Rho|\#929);/P/g; + $result =~ s/&(Sigma|\#931);/\$\\Sigma \$/g; + $result =~ s/&(Tau|\#932);/T/g; + $result =~ s/&(Upsilon|\#933);/\$\\Upsilon \$/g; + $result =~ s/&(Phi|\#934);/\$\\Phi \$/g; + $result =~ s/&(Chi|\#935);/X/g; + $result =~ s/&(Psi|\#936);/\$\\Psi \$/g; + $result =~ s/&(Omega|\#937);/\$\\Omega \$/g; +#Arrows (extended HTML 4.01) + $result =~ s/&(larr|\#8592);/\$\\leftarrow \$/g; + $result =~ s/&(uarr|\#8593);/\$\\uparrow \$/g; + $result =~ s/&(rarr|\#8594);/\$\\rightarrow \$/g; + $result =~ s/&(darr|\#8595);/\$\\downarrow \$/g; + $result =~ s/&(harr|\#8596);/\$\\leftrightarrow \$/g; + $result =~ s/&(lArr|\#8656);/\$\\Leftarrow \$/g; + $result =~ s/&(uArr|\#8657);/\$\\Uparrow \$/g; + $result =~ s/&(rArr|\#8658);/\$\\Rightarrow \$/g; + $result =~ s/&(dArr|\#8659);/\$\\Downarrow \$/g; + $result =~ s/&(hArr|\#8660);/\$\\Leftrightarrow \$/g; +#Mathematical Operators (extended HTML 4.01) + $result =~ s/&(forall|\#8704);/\$\\forall \$/g; + $result =~ s/&(part|\#8706);/\$\\partial \$/g; + $result =~ s/&(exist|\#8707);/\$\\exists \$/g; + $result =~ s/&(empty|\#8709);/\$\\emptyset \$/g; + $result =~ s/&(nabla|\#8711);/\$\\nabla \$/g; + $result =~ s/&(isin|\#8712);/\$\\in \$/g; + $result =~ s/&(notin|\#8713);/\$\\notin \$/g; + $result =~ s/&(ni|\#8715);/\$\\ni \$/g; + $result =~ s/&(prod|\#8719);/\$\\prod \$/g; + $result =~ s/&(sum|\#8721);/\$\\sum \$/g; + $result =~ s/&(minus|\#8722);/\$-\$/g; + $result =~ s/&(lowast|\#8727);/\$*\$/g; + $result =~ s/&(radic|\#8730);/\$\\surd \$/g; + $result =~ s/&(prop|\#8733);/\$\\propto \$/g; + $result =~ s/&(infin|\#8734);/\$\\infty \$/g; + $result =~ s/&(ang|\#8736);/\$\\angle \$/g; + $result =~ s/&(and|\#8743);/\$\\wedge \$/g; + $result =~ s/&(or|\#8744);/\$\\vee \$/g; + $result =~ s/&(cap|\#8745);/\$\\cap \$/g; + $result =~ s/&(cup|\#8746);/\$\\cup \$/g; + $result =~ s/&(int|\#8747);/\$\\int \$/g; + $result =~ s/&(sim|\#8764);/\$\\sim \$/g; + $result =~ s/&(cong|\#8773);/\$\\cong \$/g; + $result =~ s/&(asymp|\#8776);/\$\\approx \$/g; + $result =~ s/&(ne|\#8800);/\$\\not= \$/g; + $result =~ s/&(equiv|\#8801);/\$\\equiv \$/g; + $result =~ s/&(le|\#8804);/\$\\leq \$/g; + $result =~ s/&(ge|\#8805);/\$\\geq \$/g; + $result =~ s/&(sub|\#8834);/\$\\subset \$/g; + $result =~ s/&(sup|\#8835);/\$\\supset \$/g; + $result =~ s/&(nsub|\#8836);/\$\\not\\subset \$/g; + $result =~ s/&(sube|\#8838);/\$\\subseteq \$/g; + $result =~ s/&(supe|\#8839);/\$\\supseteq \$/g; + $result =~ s/&(oplus|\#8853);/\$\\oplus \$/g; + $result =~ s/&(otimes|\#8855);/\$\\otimes \$/g; + $result =~ s/&(perp|\#8869);/\$\\perp \$/g; + $result =~ s/&(sdot|\#8901);/\$\\cdot \$/g; +#Geometric Shapes (extended HTML 4.01) + $result =~ s/&(loz|\#9674);/\$\\Diamond \$/g; +#Miscellaneous Symbols (extended HTML 4.01) + $result =~ s/&(spades|\#9824);/\$\\spadesuit \$/g; + $result =~ s/&(clubs|\#9827);/\$\\clubsuit \$/g; + $result =~ s/&(hearts|\#9829);/\$\\heartsuit \$/g; + $result =~ s/&(diams|\#9830);/\$\\diamondsuit \$/g; + return $result; } -sub additional_class_menu { - my $r = shift; - $r->print(< - - - -

Mark students which assignments you want to print

-ENDMENUOUT1 - my %courselist=&Apache::lonnet::dump( - 'classlist', - $ENV{'course.'.$ENV{'request.course.id'}.'.domain'}, - $ENV{'course.'.$ENV{'request.course.id'}.'.num'}); - my $now=time; - $r->print(< - -  - -  - -

-ENDDISHEADER - my $i = 0; - foreach (sort keys %courselist) { - my ($end,$start)=split(/\:/,$courselist{$_}); - my $active=1; - if (($end) && ($now>$end)) { $active=0; } - if ($active) { - my ($sname,$sdom)=split(/\:/,$_); - my %reply=&Apache::lonnet::get('environment', - ['firstname','middlename','lastname','generation'], - $sdom,$sname); - my $section=&Apache::lonnet::usection - ($sdom,$sname,$ENV{'request.course.id'}); - $r->print( - '
'. - $reply{'firstname'}.' '. - $reply{'middlename'}.' '. - $reply{'lastname'}.' '. - $reply{'generation'}. - ' ('.$_.') '.$section); - $i++; - } + if ($tableofcontents eq 'yes') {$text=~s/(\\setcounter\{page\}\{1\})/$1 \\tableofcontents\\newpage /;} + if ($indexlist eq 'yes') { + $text=~s/(\\begin{document})/\\makeindex $1/; + $text=~s/(\\end{document})/\\strut\\\\\\strut\\printindex $1/; } - $r->print(< - - - -ENDMENUOUT2 + return $text; } -sub additional_print_menu { - my $r = shift; - my $what_to_print = ''; - for (my $i=0; $i<$ENV{'form.numberofstudents'};$i++) { - $what_to_print .= ''; - } - $r->print(< - - - - -Define page layout parameters:
-Width:
-Height:
-Left margin:
- - - - - -ENDMENUOUT +sub page_cleanup { + my $result = shift; + + $result =~ m/\\end{document}(\d*)$/; + my $number_of_columns = $1; + my $insert = '{'; + for (my $id=1;$id<=$number_of_columns;$id++) { $insert .='l'; } + $insert .= '}'; + $result =~ s/(\\begin{longtable})INSERTTHEHEADOFLONGTABLE\\endfirsthead\\endhead/$1$insert/g; + $result =~ s/&\s*REMOVETHEHEADOFLONGTABLE\\\\/\\\\/g; + return $result,$number_of_columns; +} + + +sub details_for_menu { + + my $name_of_resourse = &Apache::lonnet::gettitle($ENV{'form.postdata'}); + my $symbolic = &Apache::lonnet::symbread($ENV{'form.postdata'}); + my ($map,$id,$resource)=&Apache::lonnet::decode_symb($symbolic); + $map=&Apache::lonnet::clutter($map); + my $name_of_sequence = &Apache::lonnet::gettitle($map); + if ($name_of_sequence =~ /^\s*$/) { + $map =~ m|([^/]+)$|; + $name_of_sequence = $1; + } + my $name_of_map = &Apache::lonnet::gettitle($ENV{'request.course.uri'}); + if ($name_of_map =~ /^\s*$/) { + $ENV{'request.course.uri'} =~ m|([^/]+)$|; + $name_of_map = $1; + } + return ($name_of_resourse,$name_of_sequence,$name_of_map); + +} + + +sub latex_corrections { + + my ($number_of_columns,$result) = @_; + +# $result =~ s/\\includegraphics{/\\includegraphics\[width=\\minipagewidth\]{/g; + $result =~ s/\$number_of_columns/$number_of_columns/g; + $result =~ s/(\\end{document})/\\strut\\newline\\noindent\\makebox\[\\textwidth\/$number_of_columns\]\[b\]{\\hrulefill}\\newline\\noindent\\tiny Printed from LON-CAPA\\copyright MSU{\\hfill} Licensed under GNU General Public License $1/; + $result =~ s/(\\end{longtable}\s*)(\\strut\\newline\\noindent\\makebox\[\\textwidth\/$number_of_columns\]\[b\]{\\hrulefill})/$2$1/g; + $result =~ s/(\\end{longtable}\s*)\\strut\\newline/$1/g; +#-- LaTeX corrections + my $first_comment = index($result,'',$first_comment); + substr($result,$first_comment,$end_comment-$first_comment+3) = ''; + $first_comment = index($result,'',$first_comment); - substr($result,$first_comment,$end_comment-$first_comment+3) = ''; - $first_comment = index($result,'