Hi everyone. I’m trying to compile my project’s documentation in latex. I get an error that I think has to do with utf-8 characters in a few source files. Here’s the error:
[debug] ?- make_tex.
ERROR: I/O error in write on stream <stream>(000000000BF1A4B0) (Encoding cannot represent character)
ERROR: In:
ERROR: [57] format(<stream>(000000000BF1A4B0),'~w',['?- list_mil_problem(list_last/2).\nPositive examples\n-----------------\nlist_last([a],a).\nlist_last([1,2],2).\nlist_last([a1,b2,c3],c3).\n\nNegative examples\n-----------------\n[]\n\nBackground knowledge\n--------------------\nhead/2:\nhead([A|B],A).\n\ntail/2:\ntail([A|B],B).\n\nempty/1:\nempty([]).\n\nMetarules\n---------\n(M1) ∃.P,Q,R,S ∀.x,y,z: P(x,y)← Q(x,z),R(z),S(x,y)\n(M2) ∃.P,Q,R,S,T ∀.x,y,z,u: P(x,y)← Q(x,z),R(z,u),S(u),T(z,y)\n(M3) ∃.P,Q,R,S,T,P1 ∀.x,y,z,u,v: P(x,y)← Q(x,z),R(z,u),S(u,v),T(v),P1(u,y)\ntrue.'])
ERROR: [56] pldoc_latex:print_latex_token(code('?- list_mil_problem(list_last/2).\nPositive examples\n-----------------\nlist_last([a],a).\nlist_last([1,2],2).\nlist_last([a1,b2,c3],c3).\n\nNegative examples\n-----------------\n[]\n\nBackground knowledge\n--------------------\nhead/2:\nhead([A|B],A).\n\ntail/2:\ntail([A|B],B).\n\nempty/1:\nempty([]).\n\nMetarules\n---------\n(M1) ∃.P,Q,R,S ∀.x,y,z: P(x,y)← Q(x,z),R(z),S(x,y)\n(M2) ∃.P,Q,R,S,T ∀.x,y,z,u: P(x,y)← Q(x,z),R(z,u),S(u),T(z,y)\n(M3) ∃.P,Q,R,S,T,P1 ∀.x,y,z,u,v: P(x,y)← Q(x,z),R(z,u),S(u,v),T(v),P1(u,y)\ntrue.'),<stream>(000000000BF1A4B0)) at c:/program files/swipl/library/doc_latex.pl:1552
ERROR: [55] pldoc_latex:print_latex_tokens([code('?- list_mil_problem(list_last/2).\nPositive examples\n-----------------\nlist_last([a],a).\nlist_last([1,2],2).\nlist_last([a1,b2,c3],c3).\n\nNegative examples\n-----------------\n[]\n\nBackground knowledge\n--------------------\nhead/2:\nhead([A|B],A).\n\ntail/2:\ntail([A|B],B).\n\nempty/1:\nempty([]).\n\nMetarules\n---------\n(M1) ∃.P,Q,R,S ∀.x,y,z: P(x,y)← Q(x,z),R(z),S(x,y)\n(M2) ∃.P,Q,R,S,T ∀.x,y,z,u: P(x,y)← Q(x,z),R(z,u),S(u),T(z,y)\n(M3) ∃.P,Q,R,S,T,P1 ∀.x,y,z,u,v: P(x,y)← Q(x,z),R(z,u),S(u,v),T(v),P1(u,y)\ntrue.'),...|...],<stream>(000000000BF1A4B0)) at c:/program files/swipl/library/doc_latex.pl:1517
ERROR: [54] pldoc_latex:print_latex_tokens([nl_exact(2),...|...],<stream>(000000000BF1A4B0)) at c:/program files/swipl/library/doc_latex.pl:1515
ERROR: [53] pldoc_latex:print_latex_tokens([:,...|...],<stream>(000000000BF1A4B0)) at c:/program files/swipl/library/doc_latex.pl:1518
ERROR: [52] pldoc_latex:print_latex_tokens([elements,:|...],<stream>(000000000BF1A4B0)) at c:/program files/swipl/library/doc_latex.pl:1518
ERROR: [51] pldoc_latex:print_latex_tokens([' ',elements|...],<stream>(000000000BF1A4B0)) at c:/program files/swipl/library/doc_latex.pl:1518
ERROR: [50] pldoc_latex:print_latex_tokens([problem,' '|...],<stream>(000000000BF1A4B0)) at c:/program files/swipl/library/doc_latex.pl:1518
ERROR: [49] pldoc_latex:print_latex_tokens([' ',problem|...],<stream>(000000000BF1A4B0)) at c:/program files/swipl/library/doc_latex.pl:1518
ERROR: [48] pldoc_latex:print_latex_tokens(['MIL',' '|...],<stream>(000000000BF1A4B0)) at c:/program files/swipl/library/doc_latex.pl:1518
ERROR: [47] pldoc_latex:print_latex_tokens([' ','MIL'|...],<stream>(000000000BF1A4B0)) at c:/program files/swipl/library/doc_latex.pl:1518
ERROR: [46] pldoc_latex:print_latex_tokens([cmd(item),' '|...],<stream>(000000000BF1A4B0)) at c:/program files/swipl/library/doc_latex.pl:1518
ERROR: [45] pldoc_latex:print_latex_tokens([indent(4),...|...],<stream>(000000000BF1A4B0)) at c:/program files/swipl/library/doc_latex.pl:1518
ERROR: [44] pldoc_latex:print_latex_tokens([nl_exact(2),...|...],<stream>(000000000BF1A4B0)) at c:/program files/swipl/library/doc_latex.pl:1515
ERROR: [43] pldoc_latex:print_latex_tokens([code('?- list_config.\nexample_clauses(call)\nexperiment_file(data/examples/recursive_folding.pl,recursive_folding)\ngeneralise_learned_metarules(false)\ngeneralised_examples(fully)\nlearned_metarules_printing(pretty)\nlearner(louise)\nmax_invented(1)\nmetarule_learning_limits(metasubstitutions(1))\nminimal_program_size(2,inf)\nrecursion_depth_limit(dynamic_learning,none)\nrecursive_reduction(false)\nreduce_learned_metarules(false)\nreduction(plotkins)\nresolutions(5000)\nsymbol_range(predicate,[P,Q,R,S,T])\nsymbol_range(variable,[X,Y,Z,U,V,W])\ntheorem_prover(resolution)\nunfold_invented(false)\ntrue.'),...|...],<stream>(000000000BF1A4B0)) at c:/program files/swipl/library/doc_latex.pl:1518
ERROR: [42] pldoc_latex:print_latex_tokens([nl_exact(2),...|...],<stream>(000000000BF1A4B0)) at c:/program files/swipl/library/doc_latex.pl:1515
ERROR: [41] pldoc_latex:print_latex_tokens([:,...|...],<stream>(000000000BF1A4B0)) at c:/program files/swipl/library/doc_latex.pl:1518
ERROR: [40] pldoc_latex:print_latex_tokens([configuration,:|...],<stream>(000000000BF1A4B0)) at c:/program files/swipl/library/doc_latex.pl:1518
ERROR: [39] pldoc_latex:print_latex_tokens([' ',configuration|...],<stream>(000000000BF1A4B0)) at c:/program files/swipl/library/doc_latex.pl:1518
ERROR: [38] pldoc_latex:print_latex_tokens([good,' '|...],<stream>(000000000BF1A4B0)) at c:/program files/swipl/library/doc_latex.pl:1518
^ Exception: (57) format(<stream>(000000000BF1A4B0), '~w', ['?- list_mil_problem(list_last/2).\nPositive examples\n-----------------\nlist_last([a],a).\nlist_last([1,2],2).\nlist_last([a1,b2,c3],c3).\n\nNegative examples\n-----------------\n[]\n\nBackground knowledge\n--------------------\nhead/2:\nhead([A|B],A).\n\ntail/2:\ntail([A|B],B).\n\nempty/1:\nempty([]).\n\nMetarules\n---------\n(M1) ∃.P,Q,R,S ∀.x,y,z: P(x,y)← Q(x,z),R(z),S(x,y)\n(M2) ∃.P,Q,R,S,T ∀.x,y,z,u: P(x,y)← Q(x,z),R(z,u),S(u),T(z,y)\n(M3) ∃.P,Q,R,S,T,P1 ∀.x,y,z,u,v: P(x,y)← Q(x,z),R(z,u),S(u,v),T(v),P1(u,y)\ntrue.']) ? abort
% Execution Aborted
The reason must have something to do with the quantifiers and left-arrow used in some places, like the following:
(M1) ∃.P,Q,R,S ∀.x,y,z: P(x,y)← Q(x,z),R(z),S(x,y)
Is this something I can correct in latex or is it something I can fix in SWI-Prolog, e.g. with a prolog flag?
I’m uploading the two files I used to build the latex in case they help:
make_tex.pl (4.1 KB)
make_tex_configuration.pl (1.5 KB)
I start the compilation with a call to make_tex/0
, defined in make_tex.pl
. This gathers necessary files and passes them to doc_latex/3
. The source file has instructions to run it.
The other file is the configuration for make_tex.pl. I used pldoc.sty
as a style file without any changes.
Btw, I can’t remember writing that code for make_tex. I probably copied it from somewhere on the SWI-Prolog website. Or not. I can’t remember writing most of the code that I seem to have written