aboutsummaryrefslogtreecommitdiffhomepage
path: root/lib/sisu/texpdf.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/sisu/texpdf.rb')
-rw-r--r--lib/sisu/texpdf.rb204
1 files changed, 64 insertions, 140 deletions
diff --git a/lib/sisu/texpdf.rb b/lib/sisu/texpdf.rb
index 923b7ad1..9850aeef 100644
--- a/lib/sisu/texpdf.rb
+++ b/lib/sisu/texpdf.rb
@@ -1,57 +1,55 @@
-# encoding: utf-8
-=begin
-
-* Name: SiSU
-
-** Description: documents, structuring, processing, publishing, search
-*** LaTeX generation
-
-** Author: Ralph Amissah
- [ralph@amissah.com]
- [ralph.amissah@gmail.com]
-
-** Copyright: (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006,
- 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014, 2015, 2016 Ralph Amissah,
- All Rights Reserved.
-
-** License: GPL 3 or later:
-
- SiSU, a framework for document structuring, publishing and search
-
- Copyright (C) Ralph Amissah
-
- This program is free software: you can redistribute it and/or modify it
- under the terms of the GNU General Public License as published by the Free
- Software Foundation, either version 3 of the License, or (at your option)
- any later version.
-
- This program is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
- more details.
-
- You should have received a copy of the GNU General Public License along with
- this program. If not, see [http://www.gnu.org/licenses/].
-
- If you have Internet connection, the latest version of the GPL should be
- available at these locations:
- [http://www.fsf.org/licensing/licenses/gpl.html]
- [http://www.gnu.org/licenses/gpl.html]
-
-** SiSU uses:
- * Standard SiSU markup syntax,
- * Standard SiSU meta-markup syntax, and the
- * Standard SiSU object citation numbering and system
-
-** Hompages:
- [http://www.jus.uio.no/sisu]
- [http://www.sisudoc.org]
-
-** Git
- [http://git.sisudoc.org/gitweb/?p=code/sisu.git;a=summary]
- [http://git.sisudoc.org/gitweb/?p=code/sisu.git;a=blob;f=lib/sisu/texpdf.rb;hb=HEAD]
-
-=end
+#encoding: utf-8
+#- Name: SiSU
+#
+# - Description: documents, structuring, processing, publishing, search
+# texpdf
+#
+# - Author: Ralph Amissah
+# <ralph.amissah@gmail.com>
+#
+# - Copyright: (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006,
+# 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014, 2015, 2016, 2017, 2019,
+# 2020, 2021, Ralph Amissah,
+# All Rights Reserved.
+#
+# - License: GPL 3 or later:
+#
+# SiSU, a framework for document structuring, publishing and search
+#
+# Copyright (C) Ralph Amissah
+#
+# This program is free software: you can redistribute it and/or modify it
+# under the terms of the GNU General Public License as published by the Free
+# Software Foundation, either version 3 of the License, or (at your option)
+# any later version.
+#
+# This program is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
+# more details.
+#
+# You should have received a copy of the GNU General Public License along with
+# this program. If not, see <http://www.gnu.org/licenses/>.
+#
+# If you have Internet connection, the latest version of the GPL should be
+# available at these locations:
+# <http://www.fsf.org/licensing/licenses/gpl.html>
+# <http://www.gnu.org/licenses/gpl.html>
+#
+# <http://www.sisudoc.org/sisu/en/manifest/gpl.fsf.html>
+#
+# - SiSU uses:
+# - Standard SiSU markup syntax,
+# - Standard SiSU meta-markup syntax, and the
+# - Standard SiSU object citation numbering and system
+#
+# - Homepages:
+# <http://www.sisudoc.org>
+#
+# - Git
+# <https://git.sisudoc.org/projects/>
+# <https://git.sisudoc.org/projects/sisu>
+# <https://git.sisudoc.org/projects/sisu-markup>
module SiSU_TeX
begin
require 'pstore'
@@ -70,7 +68,7 @@ module SiSU_TeX
@@tabular="{tabular}"
@@column_instruct=@@squigle_close=@@tex_line_mode=@@tex_word_mode=@@line_mode=''
@@tex_debug_counter=@@table_pagebreak_counter=@@tex_footnote_call_counter=@@tex_table_flag=@@tex_counter=@@tex_column=@@tex_columns=@@tex_columns=@@counting=0
- @@tex_pattern_margin_number=/\\\\begin\\\{tiny\\\}\\\\hspace\\\{0mm\\\}\\\\end\\\{tiny\\\}\\\{\\\\marginpar.+?\s+/
+ @@tex_pattern_margin_number=/\\\\ocn\\\{[0-9]+\\\}/
@@n=@@tableheader=@@rights=nil
@@date ||=SiSU_Env::InfoDate.new
class Source
@@ -741,65 +739,6 @@ module SiSU_TeX
end
dob
end
- def tex_box_listings
- <<-WOK
-\\definecolor{listinggray}{gray}{0.9}
-\\definecolor{lbcolor}{rgb}{0.9,0.9,0.9}
-\\lstset{
- backgroundcolor=\\color{lbcolor},
- tabsize=4,
- rulecolor=,
- language=,
- basicstyle=\\scriptsize,
- upquote=true,
- aboveskip={1.5\\baselineskip},
- columns=fixed,
- showstringspaces=false,
- extendedchars=true,
- breaklines=true,
- prebreak = \\raisebox{0ex}[0ex][0ex]{\\ensuremath{\\hookleftarrow}},
- frame=single,
- showtabs=false,
- showspaces=false,
- showstringspaces=false,
- identifierstyle=\\ttfamily,
- keywordstyle=\\color[rgb]{0,0,1},
- commentstyle=\\color[rgb]{0.133,0.545,0.133},
- stringstyle=\\color[rgb]{0.627,0.126,0.941},
-}
- WOK
- end
- def tex_box_boites
- <<-WOK
-\\def\\codeblockboitebox{%
- \\def\\bkvz@before@breakbox{\\ifhmode\\par\\fi\\vskip\\breakboxskip\\relax}%
- \\def\\bkvz@set@linewidth{\\advance\\linewidth -2\\fboxrule
- \\advance\\linewidth -2\\fboxsep} %
- \\def\\bk@line{\\hbox to \\linewidth{%
- \\ifbkcount\\smash{\\llap{\\the\\bk@lcnt\\ }}\\fi
- \\psframebox*[framesep=0pt,linewidth=0pt]{%
- \\vrule\\@width\\fboxrule \\hskip\\fboxsep
- \\box\\bk@bxa
- \\hskip\\fboxsep \\vrule\\@width\\fboxrule
- }%
- }}%
- %\\def\\bkvz@top{\\hrule\\@height\\fboxrule}
- \\def\\bkvz@top{\\hrule height .6pt}%
- \\def\\bkvz@bottom{\\hrule\\@height\\fboxrule}%
- \\breakbox}
-\\def\\endcodeblockboitebox{\\endbreakbox}
- WOK
- end
- def tex_codeblock
- codeblock_box=if @codeblock_box=='listings'
- tex_box_listings
- elsif @codeblock_box=='boites'
- tex_box_boites
- else
- tex_box_boites
- end
- codeblock_box
- end
def markup(data)
@tex_file=[]
home=the_text.txt_home.gsub(/#{Mx[:br_line]}|#{Mx[:br_nl]}|#{Mx[:br_paragraph]}|\\\\/,' - ') #no line splitting in heading neither html nor latex
@@ -818,31 +757,6 @@ module SiSU_TeX
end
@tex_file << <<-WOK
#{@tex_ml.header}#{@tex_ml.footer}
-\\tolerance=300
-\\clubpenalty=300
-\\widowpenalty=300
-\\makeatother
-\\makeatother
-\\chardef\\txtbullet="2022
-\\chardef\\tilde="7E
-%\\chardef\\asterisk="2A
-\\def\\asterisk{{\\rm \\char42} }
-\\definecolor{Light}{gray}{.92}
-\\newcommand{\\Codeblock}[1]{\\normaltext\\raggedright\\small\\ttfamily\\texbackslash#1}
-\\newcommand{\\monosp}[1]{\\normaltext\\ttfamily\\texbackslash#1}
-\\newcommand{\\parasep}{\\\\ \\begin{center}*\\hspace{2em}*\\hspace{2em}*\\end{center} \\\\}
-\\newcommand{\\hardspace}{{~}}
-%\\newcommand{\\hardspace}{\\hspace{.5em}}
-\\newcommand{\\caret}{{\\^{~}}}
-\\newcommand{\\pipe}{{\\textbar}}
-\\newcommand{\\curlyopen}{\{}
-\\newcommand{\\curlyclose}{\}}
-\\newcommand{\\lt}{{\UseTextSymbol{OML}{<}}}
-\\newcommand{\\gt}{{\UseTextSymbol{OML}{>}}}
-\\newcommand{\\slash}{{/}}
-\\newcommand{\\underscore}{\\_}
-\\newcommand{\\exclaim}{\\Verbatim{!}}
-#{tex_codeblock}
% (tilde hash amp affected by http)
% \\sloppy
\\begin{document}
@@ -900,8 +814,12 @@ module SiSU_TeX
x={}
if (@make.build.toc?)
toc=<<-WOK
+\\clearpage
+\\pagenumbering{roman}
+\\setcounter{page}{1}
\\renewcommand{\\contentsname}{#{@translate.contents}}
\\tableofcontents
+\\clearpage
WOK
toc_pb={ l: @tex_ml.newpage(:landscape), p: @tex_ml.newpage(:portrait) }
else
@@ -914,6 +832,9 @@ module SiSU_TeX
\\pagestyle{fancy}
#{toc}#{toc_pb[:l]}
\\pagenumbering{arabic}
+\\clearpage
+\\setcounter{page}{2}
+\\clearpage
#{@tex_ml.paraskip_normal}
#{@tex_ml.newpage(:landscape)}
WOK
@@ -925,6 +846,9 @@ module SiSU_TeX
#{toc}#{toc_pb[:p]}
#{@tex_ml.newpage(:portrait)}
\\pagenumbering{arabic}
+\\clearpage
+\\setcounter{page}{2}
+\\clearpage
#{@tex_ml.paraskip_normal}
#{@tex_ml.newpage(:portrait)}
WOK
@@ -990,7 +914,7 @@ module SiSU_TeX
# tags=tags +"\\hspace{0mm}\\hypertarget{#{t}}{\\hspace{0mm}}"
# end
#end
- "\\begin{tiny}\\hspace{0mm}\\end{tiny}{\\marginpar{\\begin{tiny}\\hspace{0mm}\\hypertarget{#{dob.ocn}}{#{dob.ocn}}#{tags}\\end{tiny}}}" #ocn object citation numbering
+ "\\ocn{#{dob.ocn}}" #ocn object citation numbering
else ''
end
dob.tmp = paranumber_display + dob.tmp