Skip to content
This repository has been archived by the owner on Nov 17, 2022. It is now read-only.

Commit

Permalink
Paragraph indent, caption 2 line
Browse files Browse the repository at this point in the history
  • Loading branch information
geier1993 committed Aug 27, 2018
1 parent 5fc9a7c commit be39a5f
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 3 deletions.
16 changes: 13 additions & 3 deletions src/pandocLatex.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,11 +95,21 @@ def adjustLongtableFilter(inputgen):
# editor: https://regex101.com
def adjustFigureCaption(inputgen):
#for (ln,lc,l) in inputgen:
ltmp = ""
for lobj in inputgen:
if(lobj.line!=None):
if((lobj.line!=None)):
if(lobj.line.startswith("\\caption")):
#ltmp += lobj.line.rstrip('\n')
ltmp += lobj.line
lobj.line = ""
elif(ltmp!=""):
lobj.line = ltmp + lobj.line
ltmp = ""
# re.DOTALL makes . also match new line \n
lobj.line=re.sub(r'(\\caption){{\[}{\[}(.+?(?={\]}{\]})){\]}{\]}',
r'\1[\2]{',lobj.line)
#yield (ln,lc,l)
r'\1[\2]{',lobj.line,flags=re.DOTALL)
lobj.line=re.sub(r'(\\caption){(\\label{.+?}){\[}{\[}(.+?(?={\]}{\]})){\]}{\]}',
r'\1[\3]{\2',lobj.line,flags=re.DOTALL)
yield lobj


Expand Down
6 changes: 6 additions & 0 deletions template/document.latex
Original file line number Diff line number Diff line change
Expand Up @@ -398,6 +398,7 @@ $endif$

$if(graphics)$
\usepackage{graphicx,grffile}
\usepackage{wrapfig}
\makeatletter
\def\maxwidth{\ifdim\Gin@nat@width>\linewidth\linewidth\else\Gin@nat@width\fi}
\def\maxheight{\ifdim\Gin@nat@height>\textheight\textheight\else\Gin@nat@height\fi}
Expand All @@ -418,6 +419,7 @@ $if(strikeout)$
\pdfstringdefDisableCommands{\renewcommand{\sout}{}}
$endif$
$if(indent)$
\usepackage{indentfirst}
$else$
\IfFileExists{parskip.sty}{%
\usepackage{parskip}
Expand Down Expand Up @@ -543,6 +545,10 @@ $endif$
$if(tikzlibrary)$
\usetikzlibrary{$for(tikzlibrary)$$tikzlibrary$$sep$,$endfor$}
$endif$
$if(afterktikz)$
$for(afterktikz)$$afterktikz$$endfor$
$endif$


$if(psgraf)$
\usepackage[$for(psgrafoptions)$$psgrafoptions$$sep$,$endfor$]{PSgraf}
Expand Down
1 change: 1 addition & 0 deletions template/format_thesis.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ documentclass: report
# - ""

geometry: "yes"
indent: "yes"
# https://de.sharelatex.com/learn/Page_size_and_margins
geometryoptions:
# - "textheight=9.0in"
Expand Down

0 comments on commit be39a5f

Please sign in to comment.