Org export: reformat LaTeX checkboxes
This commit is contained in:
parent
c4ff8d34ed
commit
20c70c788b
31
config.org
31
config.org
|
@ -2966,27 +2966,54 @@ be unaffected lest's use ~;~ as a prefix to prevent the transformation --- i.e.
|
|||
'tec/org-export-latex-filter-acronym))
|
||||
#+END_SRC
|
||||
|
||||
#+BEGIN_SRC emacs-lisp
|
||||
(after! org
|
||||
(defun tec/org-export-latex-fancy-item-checkboxes (text backend info)
|
||||
(when (org-export-derived-backend-p backend 'latex)
|
||||
(replace-regexp-in-string
|
||||
"\\\\item\\[{$\\\\\\(\\w+\\)$}\\]"
|
||||
(lambda (fullmatch)
|
||||
(concat "\\\\item[" (pcase (substring fullmatch 9 -3) ; content of capture group
|
||||
("square" "\\\\ifdefined\\\\checkboxUnchecked\\\\checkboxUnchecked\\\\else$\\\\square$\\\\fi" )
|
||||
("boxminus" "\\\\ifdefined\\\\checkboxTransitive\\\\checkboxTransitive\\\\else$\\\\boxminus$\\\\fi")
|
||||
("boxtimes" "\\\\ifdefined\\\\checkboxChecked\\\\checkboxChecked\\\\else$\\\\boxtimes$\\\\fi" )
|
||||
(_ (substring fullmatch 9 -3))) "]"))
|
||||
text)))
|
||||
|
||||
(add-to-list 'org-export-filter-item-functions
|
||||
'tec/org-export-latex-fancy-item-checkboxes))
|
||||
#+END_SRC
|
||||
|
||||
Now for a few more adjustments.
|
||||
#+BEGIN_SRC emacs-lisp
|
||||
(after! ox-latex
|
||||
(add-to-list 'org-latex-classes
|
||||
'("fancy-article"
|
||||
"\\documentclass{scrartcl}\n\
|
||||
"\\documentclass{scrartcl}\n\
|
||||
\\usepackage[T1]{fontenc}\n\
|
||||
\\usepackage[osf,largesc,helvratio=0.9]{newpxtext}\n\
|
||||
\\usepackage[scale=0.92]{sourcecodepro}\n\
|
||||
\\usepackage[varbb]{newpxmath}\n\
|
||||
|
||||
\\usepackage[activate={true,nocompatibility},final,tracking=true,kerning=true,spacing=true,factor=2000]{microtype}\n\
|
||||
\\usepackage{xcolor}\n\
|
||||
\\usepackage{booktabs}
|
||||
|
||||
\\usepackage{subcaption}
|
||||
\\usepackage[hypcap=true]{caption}
|
||||
\\setkomafont{caption}{\\sffamily\\small}
|
||||
\\setkomafont{captionlabel}{\\upshape\\bfseries}
|
||||
\\captionsetup{justification=raggedright,singlelinecheck=true}
|
||||
\\setcapindent{0pt}
|
||||
|
||||
\\setlength{\\parskip}{\\baselineskip}\n\
|
||||
\\setlength{\\parindent}{0pt}"
|
||||
\\setlength{\\parindent}{0pt}\n\
|
||||
|
||||
\\usepackage{pifont}
|
||||
\\newcommand{\\checkboxUnchecked}{$\\square$}
|
||||
\\newcommand{\\checkboxTransitive}{\\rlap{\\raisebox{0.0ex}{\\hspace{0.35ex}\\Large\\textbf -}}$\\square$}
|
||||
\\newcommand{\\checkboxChecked}{\\rlap{\\raisebox{0.2ex}{\\hspace{0.35ex}\\scriptsize \\ding{56}}}$\\square$}
|
||||
"
|
||||
("\\section{%s}" . "\\section*{%s}")
|
||||
("\\subsection{%s}" . "\\subsection*{%s}")
|
||||
("\\subsubsection{%s}" . "\\subsubsection*{%s}")
|
||||
|
|
Loading…
Reference in a new issue