parent
a6394801ed
commit
bb33afb4da
|
@ -796,61 +796,26 @@ formatc()
|
|||
-name "*.[ch]~" -o \
|
||||
-name "*.[ch]~[0-9]*~" \) \
|
||||
-delete
|
||||
}
|
||||
|
||||
## LaTeX quick compiler. It adds the preambule -- and the \end{document} --
|
||||
## automatically.
|
||||
ltx()
|
||||
{
|
||||
if [ $# -ne 1 ]; then
|
||||
echo "Usage: $0 FILE"
|
||||
return
|
||||
fi
|
||||
|
||||
# ## Manual method.
|
||||
# ## Remove trailing whitespace
|
||||
# sed -i 's/\s*$//g' "$FILE"
|
||||
local PREAMBLE
|
||||
local END
|
||||
|
||||
# ## Function parenthesis
|
||||
# sed -i 's/\([^ ]\)(/\1 (/g' "$FILE"
|
||||
# sed -i 's/\s\s\+(/ (/g' "$FILE"
|
||||
|
||||
# ## Semicolon
|
||||
# sed -i 's/\([^ ]\);/\1 ;/g' "$FILE"
|
||||
# sed -i 's/;\([^ ]\)/; \1/g' "$FILE"
|
||||
# # Skip line -- Bad idea because of 'for' loops.
|
||||
# # sed -i 's/^\(\s*\)\(.*\);\s*\(.\+\)$/\1\2;\n\1\3/g' "$FILE"
|
||||
## One line is mandatory.
|
||||
PREAMBLE='\documentclass[10pt,a4paper]{article}\usepackage[utf8]{inputenc}\usepackage[T1]{fontenc}\usepackage{amsmath,amssymb,amsfonts}\usepackage{geometry}\usepackage{lmodern}\usepackage{marvosym}\usepackage{textcomp}\DeclareUnicodeCharacter{20AC}{\EUR{}}\DeclareUnicodeCharacter{2264}{\leqslant}\DeclareUnicodeCharacter{2265}{\geqslant}\begin{document}\input'
|
||||
|
||||
# ## Commas
|
||||
# sed -i 's/\s\s\+,/,/g' "$FILE"
|
||||
# sed -i 's/,\([^ ]\)/, \1/g' "$FILE"
|
||||
|
||||
# ## Plus/Minus
|
||||
# sed -i 's/\([^+-]\)\([-+]\)\([^ +-]\)/\1\2 \3/g' "$FILE"
|
||||
# sed -i 's/\([^ +-]\)\([-+]\)\([^+-]\)/\1 \2\3/g' "$FILE"
|
||||
# sed -i 's/\( \+++\)/++/g' "$FILE"
|
||||
# sed -i 's/\(++ \+\)/++/g' "$FILE"
|
||||
# sed -i 's/\( \+--\)/--/g' "$FILE"
|
||||
# sed -i 's/\(-- \+\)/--/g' "$FILE"
|
||||
|
||||
# ## Modulus, equality, affectation, binary ops, comparison
|
||||
# sed -i 's/\s\s\+\(%\|==\|&&\|||\|<=\|>=\|!=\)/ \1/g' "$FILE"
|
||||
# sed -i 's/\(%\|==\|&&\|||\|<=\|>=\|!=\)\s\s\+/\1 /g' "$FILE"
|
||||
# sed -i 's/\([^ ]\)\(%\|==\|&&\|||\|<=\|>=\|!=\)/\1 \2/g' "$FILE"
|
||||
# sed -i 's/\(%\|==\|&&\|||\|<=\|>=\|!=\)\([^ ]\)/\1 \2/g' "$FILE"
|
||||
|
||||
# ## Equality, >, <
|
||||
# sed -i 's/\s\s\+\([<>=]\)/ \1/g' "$FILE"
|
||||
# sed -i 's/\([<>=]\)\s\s\+/\1 /g' "$FILE"
|
||||
# sed -i 's/\([<>=]\)\([^ =]\)/\1 \2/g' "$FILE"
|
||||
# sed -i 's/\([^ ]\)\([<>]\)/\1 \2/g' "$FILE"
|
||||
# sed -i 's/\([^ =<>]\)\(=\)/\1 \2/g' "$FILE"
|
||||
|
||||
# ## Asterisk, slash
|
||||
# sed -i 's/\s\s\+\*/ \*/g' "$FILE"
|
||||
# sed -i 's/\*\s\s\+/\* /g' "$FILE"
|
||||
|
||||
# sed -i 's/\([^\/]\)\/\s\+/\1\//g' "$FILE"
|
||||
# sed -i 's/\s\+\/\([^\/]\)/\/\1/g' "$FILE"
|
||||
|
||||
|
||||
# ## Braces
|
||||
# sed -i 's/^\( *\)\(.\+\) *{ *$/\1\2\n\1{/g' "$FILE"
|
||||
|
||||
# ## Proper comments
|
||||
# sed -i 's:// *\([[:lower:]]\):// \u\1:g' "$FILE"
|
||||
# sed -i 's:\(//.*[^\.]\)$:\1\.:g' "$FILE"
|
||||
END='\end{document}'
|
||||
|
||||
pdflatex -file-line-error-style -interaction nonstopmode -jobname="${1%.tex}" "$PREAMBLE" "$1" "$END"
|
||||
}
|
||||
|
||||
##==============================================================================
|
||||
|
|
Loading…
Reference in New Issue