Skip to content

Commit

Permalink
Fixed latex. pandoc on some systems uses includesvg, but I don't supp…
Browse files Browse the repository at this point in the history
…ort that
  • Loading branch information
wulffern committed Dec 28, 2023
1 parent 9afb796 commit 2cbfca2
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 25 deletions.
25 changes: 2 additions & 23 deletions pdf/fix_svg.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,24 +19,11 @@ def toPng(ftype,path):
def toPdf(ftype,path):
return imgConvert(ftype,".pdf",path)

#def toPdf(ftype,path):
# fopath = "media/"+ os.path.basename(path).replace(ftype,".pdf")
# if(not os.path.exists(fopath)):
# os.system(f"svg2pdf -o {fopath} {path}")
# return fopath

def getPath(line):
m = re.findall("{([^}]+)}",line)
path = m[0]
return path

#tmplta = r"""
#\begin{figure}[h]
#\centering
#\includegraphics[width=\myfigwidth]{#path#}
#\end{figure}
#"""

tmplt = r"""
{
\centering
Expand All @@ -51,16 +38,8 @@ def getPath(line):
with open(foname,"w") as fo:
with open(foname_png,"w") as fo_png:
for line in fi:
# if(re.search("includegraphics.*\.svg}",line)):
# path = getPath(line)
# fopath = "media/"+ os.path.basename(path).replace(".svg",".pdf")
# if(not os.path.exists(fopath)):
# os.system(f"svg2pdf -o {fopath} {path}")
# line = line.replace(path,fopath)
# elif(re.search("includegraphics.*\.gif",line)):
# path = getPath(line)
# fopath = "media/"+ os.path.basename(path).replace(".gif",".png")
# line = toPng(path,fopath,line)
#- Pandoc sometimes uses includesvg instead of includegraphics
line = line.replace("includesvg","includegraphics")
if(re.search("includegraphics{",line)):
path = getPath(line)
fopath = path
Expand Down
4 changes: 2 additions & 2 deletions pdf/version.tex
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
{\noindent Built on Thu Dec 28 11:34:47 CET 2023} \\
{\noindent from bb8c1e150c8c017cf4cf1801be7f35ec6c2a3c4b}
{\noindent Built on Thu Dec 28 12:33:26 CET 2023} \\
{\noindent from 9afb7966f1f868d2fb19d34b4cd663b8ef8e1be5}

0 comments on commit 2cbfca2

Please sign in to comment.