-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathincrease_section_level.ps1
17 lines (16 loc) · 1.09 KB
/
increase_section_level.ps1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
# This script will convert
# \section --> \chapter
# \section* --> \chapter* (non numbered, e.g Abstract)
# \subsection --> \section
# \subsubsection --> \subsection
# Optional
# \paragraph --> \subsubsection
# \subparagraph --> \paragraph
$modified_file_name = 'main_text.tex' # give file name to be edited
(gc $modified_file_name) | % {$_ -replace "\\section{", "\chapter{"} | sc $modified_file_name
(gc $modified_file_name) | % {$_ -replace "\\section*{", "\chapter*{"} | sc $modified_file_name # abstract etc non numbered chapters
(gc $modified_file_name) | % {$_ -replace "\\subsection{", "\section{"} | sc $modified_file_name
(gc $modified_file_name) | % {$_ -replace "\\subsubsection{", "\subsection{"} | sc $modified_file_name
# optional: convert \paragraph to \subsubsection and \subparagraph to \paragraph
# (gc $modified_file_name) | % {$_ -replace "\\paragraph{", "\subsubsection{"} | sc $modified_file_name # typically not used
# (gc $modified_file_name) | % {$_ -replace "\\subparagraph{", "\paragraph{"} | sc $modified_file_name # typically not used