parent
a6394801ed
commit
bb33afb4da
|
@ -796,61 +796,26 @@ formatc()
|
||||||
-name "*.[ch]~" -o \
|
-name "*.[ch]~" -o \
|
||||||
-name "*.[ch]~[0-9]*~" \) \
|
-name "*.[ch]~[0-9]*~" \) \
|
||||||
-delete
|
-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.
|
local PREAMBLE
|
||||||
# ## Remove trailing whitespace
|
local END
|
||||||
# sed -i 's/\s*$//g' "$FILE"
|
|
||||||
|
|
||||||
# ## Function parenthesis
|
## One line is mandatory.
|
||||||
# sed -i 's/\([^ ]\)(/\1 (/g' "$FILE"
|
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'
|
||||||
# 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"
|
|
||||||
|
|
||||||
# ## Commas
|
END='\end{document}'
|
||||||
# sed -i 's/\s\s\+,/,/g' "$FILE"
|
|
||||||
# sed -i 's/,\([^ ]\)/, \1/g' "$FILE"
|
pdflatex -file-line-error-style -interaction nonstopmode -jobname="${1%.tex}" "$PREAMBLE" "$1" "$END"
|
||||||
|
|
||||||
# ## 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"
|
|
||||||
}
|
}
|
||||||
|
|
||||||
##==============================================================================
|
##==============================================================================
|
||||||
|
|
Loading…
Reference in New Issue