Merge branch 'main' of git.phc.dm.unipi.it:phc/dm-scripts
commit
6fefa2d561
@ -0,0 +1,20 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Create the pdf folder if it doesn't exist
|
||||
mkdir -p pdf
|
||||
|
||||
# Iterate through all .pptx files in the current folder
|
||||
for file in *.pptx; do
|
||||
if [ -f "$file" ]; then
|
||||
# Extract the base name (without extension) of the file
|
||||
base_name=$(basename "$file" .pptx)
|
||||
|
||||
# Convert the .pptx file to .pdf and save it in the pdf folder
|
||||
libreoffice --headless --convert-to pdf --outdir pdf "$file"
|
||||
|
||||
echo "Converted $file to pdf/$base_name.pdf"
|
||||
fi
|
||||
done
|
||||
|
||||
echo "Conversion complete!"
|
||||
|
@ -0,0 +1,14 @@
|
||||
#!/bin/bash
|
||||
|
||||
if [ $# -ne 1 ]; then
|
||||
echo "Usage: $0 <input_tex_file>"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
input_file=$1
|
||||
output_file="${input_file%.tex}_without_proofs.tex"
|
||||
|
||||
awk '/\\begin{proof}/, /\\end{proof}/ {next} 1' "$input_file" > "$output_file"
|
||||
|
||||
echo "Lines between \\begin{proof} and \\end{proof} have been removed. Output saved to: $output_file"
|
||||
|
@ -0,0 +1,47 @@
|
||||
#!/bin/bash
|
||||
|
||||
if [ $# -ne 2 ]; then
|
||||
echo "Usage: $0 input.tex output.md"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
input_file="$1"
|
||||
output_file="$2"
|
||||
|
||||
# Funzione per convertire le sezioni
|
||||
convert_section() {
|
||||
local level=$1
|
||||
local name=$2
|
||||
echo -e "$(printf '#%.0s' $(seq 1 $level)) $name\n" >> "$output_file"
|
||||
}
|
||||
|
||||
# Funzione per convertire definizioni, teoremi e proposizioni
|
||||
convert_definition_or_theorem_or_proposition() {
|
||||
local type=$1
|
||||
local name=$2
|
||||
if [[ $type == "teorema" || $type == "proposizione" ]]; then
|
||||
echo "* [ ] [**$type**] $name" >> "$output_file"
|
||||
else
|
||||
echo "* [ ] [$type] $name" >> "$output_file"
|
||||
fi
|
||||
}
|
||||
|
||||
# Inizializza il file di output
|
||||
> "$output_file"
|
||||
|
||||
# Leggi il file .tex e converti le sezioni, definizioni, teoremi e proposizioni
|
||||
while IFS= read -r line; do
|
||||
if [[ $line =~ \\section\{(.+)} ]]; then
|
||||
convert_section 1 "${BASH_REMATCH[1]}"
|
||||
elif [[ $line =~ \\subsection\{(.+)} ]]; then
|
||||
convert_section 2 "${BASH_REMATCH[1]}"
|
||||
elif [[ $line =~ \\subsubsection\{(.+)} ]]; then
|
||||
convert_section 3 "${BASH_REMATCH[1]}"
|
||||
elif [[ $line =~ \\begin\{definition\}\[(.+)\] ]]; then
|
||||
convert_definition_or_theorem_or_proposition "definizione" "${BASH_REMATCH[1]}"
|
||||
elif [[ $line =~ \\begin\{theorem\}\[(.+)\](\{.+})? ]]; then
|
||||
convert_definition_or_theorem_or_proposition "teorema" "${BASH_REMATCH[1]}"
|
||||
elif [[ $line =~ \\begin\{proposition\}\[(.+)\] ]]; then
|
||||
convert_definition_or_theorem_or_proposition "proposizione" "${BASH_REMATCH[1]}"
|
||||
fi
|
||||
done < "$input_file"
|
Loading…
Reference in New Issue