I'm working on a Cook Book for my recipes. I use the cuisine package and all my recipes are in seperated files in seperated directories. To include the files in latex per hands is not the problem. But i like to automate it. Because the fies are a "work in progress" and adding or changing often. I found a bash script here: https://tex.stackexchange.com/questions/298792/sort-sections-according-to-alphabetical-order/299600#299600
. But this doesn't include directories.
Here is an example from my file structure:
tellan@tellan1:~/Dokumente/kochen/buch/buch$ ls -1g *
Suppen_Eintoepfe:
insgesamt 12K
-rwxr-xr-x 1 tellan 539 Jul 21 2017 Chilieconcarne.txt
-rwxr-xr-x 1 tellan 1,3K Jul 21 2017 Waterzooi.txt
-rw-r--r-- 1 tellan 912 Nov 8 12:45 Wild_Consomme_Mit_Bratapfelkloesschen.txtTeige_Und_Massen:
insgesamt 28K
-rw-r--r-- 1 tellan 848 Jul 22 2017 Biskuitteig.txt
-rw-r--r-- 1 tellan 633 Jul 22 2017 Brandteig.txt
-rw-r--r-- 1 tellan 226 Okt 5 15:29 Grundfarce.txt
This is my basic latex file:
\documentclass[a4paper,12pt,oneside,parskip,openany]{report}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage[ngerman]{babel}
\usepackage{geometry}
\usepackage{a4wide}
\usepackage{hyperref}
\usepackage[nonumber,contents,index]{cuisine}
\usepackage{nicefrac}
\usepackage{xpatch}
\usepackage[automark]{scrpage2}
\usepackage{ulem}
\usepackage{graphicx}
\usepackage{pdfpages}
\makeatletter
\xpatchcmd{\Displ@ySt@p}{\arabic{st@pnumber}}{}{}{}
\makeatother
\usepackage{makeidx}
\newcommand\tab[1][1cm]{\hspace*{#1}}
\renewcommand*{\recipetitlefont}{\sffamily}
\begin{document}
\title{Kochbuch}
\author{Ich}
\maketitle
\tableofcontents
\chapter{Nicht dein Kochbuch}
\newpage
\section{Vorspeisen Und Salate}
\input {Vorspeisen_Und_Salate/7-Layer-Dip.txt}
\input {Kuchen/Banana_Fudge_Brownies.txt}
\input {Kuchen/Bananen-Haferflocken-Muffins.txt}
\section{Soßen}
\input {Sossen/Asiatische_Bbq-Sosse.txt}
\input {Sossen/Barbecue-Sosse_Aus_Fertigprodukten.txt}
\input {Sossen/Currysosse_Nr_1.txt}
\section{Ect}
\input {Ect/Mengenangaben.txt}
\input {Ect/backformen.txt}
\input {Ect/umrechnungstabelle_us.txt}
\end{document}
per Hands is it working like a charme. I know it is not the cleanest command structure, but its working. Until know i can input the file via bash, but that doesnt include the directories as /section input.
#!/bin/bash
echo "" > sectionlist.tex
for sfile in `ls -1 */*.txt | cut -f 1 -d . | sort -d`
do
echo "\input {$sfile.txt}" >> sectionlist.tex
done
Thanks to Masroor for the script. I'm working with sed syntaxes as well. But without any success until now. I have not the best programming skills.