Modify

Opened 6 years ago

Closed 3 years ago

#4748 closed enhancement (fixed)

extending with own latex-packages

Reported by: trachacks@… Owned by: kisielk
Priority: normal Component: TracMathPlugin
Severity: normal Keywords:
Cc: mmitar@… Trac Release: 0.11

Description

Thanks for the well working plugin.


I extend the plugin with a mechanism that allows to extend the latex preamble (trac.ini).

extend_tex_preamble = \usepackage{boxedminipage}

Moreover the extension allows to rewrite the full latex preamble (trac.ini):

tex_preamble = \documentclass{article}\usepackage{amsmath,amsthm,amssymb}\usepackage{color}

If no attribute tex_preamble is set the default value is used.

extend_tex_preamble and tex_preamble can be used simultaneously.

Tested on trac version 0.11.1.


Because tracmath crashes if there exists e.g. a tex file in the tmp directory which does not belong to tracmath, I also extend the filenames with the prefix tracmath.

Attachments (2)

tracmath_new.py (8.0 KB) - added by anonymous 6 years ago.
full new file
ext.diff (997 bytes) - added by trachacks@… 6 years ago.
diff of original and rewritten file

Download all attachments as: .zip

Change History (6)

Changed 6 years ago by anonymous

full new file

Changed 6 years ago by trachacks@…

diff of original and rewritten file

comment:1 Changed 6 years ago by trachacks@…

diff seems not to be uploaded:

34d33
< \begin{document}
37c36
< rePNG = re.compile(r'.+png$')
---
> rePNG = re.compile(r'tracmath.+png$')
39,42c38,41
<              re.compile(r'.+aux$'),
<              re.compile(r'.+log$'),
<              re.compile(r'.+tex$'),
<              re.compile(r'.+dvi$'),
---
>              re.compile(r'tracmath.+aux$'),
>              re.compile(r'tracmath.+log$'),
>              re.compile(r'tracmath.+tex$'),
>              re.compile(r'tracmath.+dvi$'),
70a70,71
>         self.tex_preamble = self.config.get('tracmath', 'tex_preamble') or tex_preamble
>         self.extend_tex_preamble = self.config.get('tracmath', 'extend_tex_preamble') or ''
145c146
<         key = sha.new(content.encode('utf-8')).hexdigest()
---
>         key = 'tracmath'+sha.new(content.encode('utf-8')).hexdigest()
157c158,160
<                 f.write(tex_preamble)
---
>                 f.write(self.tex_preamble)
>                 f.write(self.extend_tex_preamble)
>                 f.write(r'\begin{document}')

comment:2 Changed 6 years ago by trachacks@…

An error will happen, if the tmp directory is set to '/tmp/tracmath'.

This is caused by the new file prefix and the split in line 242.

All other directory names work.

comment:3 Changed 4 years ago by kisielk

  • Owner changed from rlotun to kisielk
  • Status changed from new to assigned

comment:4 Changed 3 years ago by mitar

  • Cc mmitar@… added
  • Resolution set to fixed
  • Status changed from assigned to closed

Fixed in 0.5. You can now use your own document template.

Add Comment

Modify Ticket

Action
as closed .
The resolution will be deleted. Next status will be 'reopened'.
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.