Commit 6d42d3d65ccecafb9dcfac898cf7eacfc6b6e731

Authored by Olivier Duvernois
1 parent fd2a3f82

*** empty log message ***

anubis_dev/library/tools/latex.anubis
... ... @@ -251,6 +251,7 @@ define String
251 251 String more_ahead
252 252 ) =
253 253 "\\documentclass[a4paper,twoside,10pt]{article}\n\n"
  254 + + "\\batchmode"
254 255 + "\\setlength{\\headheight}{15pt}\n"
255 256 + "\\setlength{\\headsep}{0.5cm}\n"
256 257 + "\\setlength{\\headheight}{15pt}\n"
... ... @@ -396,7 +397,7 @@ public define ResultMakePdf
396 397 error_compilation("Error executing compilation n°"+compilation_number),
397 398 success(ec) then
398 399 print("Compilation n°"+compilation_number+" : ");
399   - if execute_control(ec,now+60)
  400 + if execute_control(ec,now+120)
400 401 then print("OK\n");
401 402 if compilation_number = 1
402 403 then make_pdf_file(file_name,mb_execution_directory,mb_pdf_directory)
... ... @@ -470,7 +471,7 @@ define One
470 471 }.
471 472  
472 473  
473   -public define One
  474 + public define One
474 475 latex_compilation
475 476 (
476 477 String file_name, // without extension
... ... @@ -526,7 +527,7 @@ public define One
526 527 }.
527 528  
528 529  
529   - public define One
  530 +public define One
530 531 latex_compilation
531 532 (
532 533 String file_name, // without extension
... ... @@ -546,4 +547,31 @@ public define One
546 547 mb_pdf_directory,compilation_number-1)
547 548 else print("Error compilation n°"+compilation_number+"\n")
548 549 }.
549   -
550 550 \ No newline at end of file
  551 +
  552 +public define One
  553 + make_pdf_file
  554 + (
  555 + String more_ahead,
  556 + LaTeX_Title title,
  557 + String core,
  558 + Bool table_of_contents,
  559 + String colors,
  560 + String file_name,
  561 + Maybe(String) mb_execution_directory,
  562 + Maybe(String) mb_pdf_directory
  563 + ) =
  564 + if write_to_file
  565 + (if mb_execution_directory is
  566 + {
  567 + failure then "",
  568 + success(s) then s
  569 + }+"/"+file_name+".tex",
  570 + to_byte_array(latex_page(more_ahead,title,core,table_of_contents,colors))) is
  571 + {
  572 + cannot_open_file then print("COF \n"),
  573 + write_error(_) then print("WE \n"),
  574 + ok then
  575 + latex_compilation(file_name,mb_execution_directory,mb_pdf_directory,
  576 + if table_of_contents then 2 else 1)
  577 + }.
  578 +
... ...
anubis_dev/library/tools/maml.anubis
... ... @@ -689,7 +689,7 @@ public type Environment:
689 689 define String
690 690 itemize_format
691 691 =
692   - "\\setlength{\\topsep}{2mm} "
  692 + "\\setlength{\\topsep}{5mm} "
693 693 + "\\setlength{\\itemindent}{5mm} "
694 694 + "\\setlength{\\itemsep}{1mm} ".
695 695  
... ... @@ -719,7 +719,16 @@ define String
719 719 itemize then ""
720 720 }
721 721 }.
722   - if member(lenv,itemize) then "\\vspace{2mm}" else "".
  722 +
  723 + define String
  724 + textcolor_close
  725 + (
  726 + List(Environment) lenv
  727 + ) =
  728 + if member(lenv,code)
  729 + then ""
  730 + else "}".
  731 +
723 732  
724 733 et de la même façon après le \end{itemize} :
725 734  
... ... @@ -728,7 +737,7 @@ define String
728 737 (
729 738 List(Environment) lenv
730 739 ) =
731   - if member(lenv,textcolor) then "" else "\\vspace{2mm}\n".
  740 + if member(lenv,textcolor) then "" else "\\vspace{5mm}\n".
732 741  
733 742  
734 743  
... ... @@ -748,7 +757,7 @@ define String
748 757  
749 758  
750 759 define String
751   - format_code_with_color
  760 + format_code_with_color2
752 761 (
753 762 List(Int8) l,
754 763 Maybe(String) sub_environment,
... ... @@ -763,14 +772,29 @@ define String
763 772 if h = '\n' then
764 773 if sub_environment is // {
765 774 {
766   - failure then end_code_color+"\\\\ "+begin_code_color,
767   - success(s) then end_code_color+"} \\\\ "+begin_code_color+s
  775 + failure then end_code_color+(if t is [] then "" else "\\\\ ")+begin_code_color,
  776 + success(s) then end_code_color+"} "+(if t is [] then "" else "\\\\ ")+begin_code_color+s
768 777 }
769 778 else transform_schar(h,latex_schar))
770   - + format_code_with_color(t,sub_environment,begin_code_color,end_code_color)
  779 + + format_code_with_color2(t,sub_environment,begin_code_color,end_code_color)
771 780 }.
772 781  
773   -
  782 +define String
  783 + format_code_with_color
  784 + (
  785 + List(Int8) l,
  786 + Maybe(String) sub_environment,
  787 + String begin_code_color,
  788 + String end_code_color,
  789 + ) =
  790 + if l is
  791 + {
  792 + [] then end_code_color,
  793 + [h . t] then
  794 + if h=13 //h = '\n' //| h = 13
  795 + then format_code_with_color(t,sub_environment,begin_code_color,end_code_color)
  796 + else format_code_with_color2(l,sub_environment,begin_code_color,end_code_color)
  797 + }.
774 798  
775 799  
776 800 define Text
... ... @@ -891,6 +915,22 @@ define Text
891 915  
892 916 Fonction générique MAML -> Text
893 917 -------------------------------
  918 +
  919 +define Bool
  920 + next_maml_is
  921 + (
  922 + MAML next,
  923 + String name
  924 + ) =
  925 + if next is
  926 + {
  927 + text(_) then false,
  928 + mark(n) then false,
  929 + mark(n,_) then (n=name),
  930 + mark(String n,MAML a1,MAML a2) then false,
  931 + mark(String n,MAML a1,MAML a2,MAML a3) then false,
  932 + m1 + m2 then (next_maml_is(m1,name) | next_maml_is(m2,name))
  933 + }.
894 934  
895 935 public define Text
896 936 to_LaTeX
... ... @@ -919,9 +959,11 @@ public define Text
919 959 -("}"+textcolor_end(lenv)) else
920 960  
921 961 if name = "red" then
922   - t-"\\textcolor{red}{"
923   - -to_LaTeX(a1,site_name,public_dir,[textcolor . lenv])
924   - -("}"+textcolor_end(lenv)) else
  962 + if next_maml_is(a1,"code")
  963 + then to_LaTeX(a1,site_name,public_dir,lenv)
  964 + else (t-"\\textcolor{red}{"
  965 + -to_LaTeX(a1,site_name,public_dir,[textcolor . lenv])
  966 + -("}"+textcolor_end(lenv))) else
925 967  
926 968 if name = "grey" then
927 969 t-"\\textcolor{my_grey}{"
... ... @@ -948,8 +990,8 @@ public define Text
948 990  
949 991 if name = "code" then
950 992 t-(" {\\tt \\setlongtables "
951   - + "\\begin{longtable}["+(if member(lenv,center) then "c" else "l")+"]{l}\n")
952   - -code_to_LaTeX(a1,failure,site_name,public_dir,[])
  993 + + "\\begin{longtable}["+(if member(lenv,center) then "c" else "l")+"]{l}\n")
  994 + -code_to_LaTeX(a1,failure,site_name,public_dir,[])
953 995 -" \\end{longtable}} \n\n " else
954 996  
955 997 if name = "center" then
... ...