README.md (8316B)
1 # LaTeX Template for BFH Reports (TI) 2 This is a LaTeX template to write a report in BFH like style. 3 4 #### Tested On 5 6 * Ubuntu 18.04, 20.04 7 * Debian 9, 10 8 * Windows 10 9 10 ## Linux Users (Ubuntu/Debian) 11 Linux users can use both an TeX GUI and the CLI. The GUI approach works the same as on Windows and OS X. 12 13 * Install used LaTeX packages: 14 ```bash 15 apt install texlive-base texlive-bibtex-extra texlive-binaries texlive-extra-utils texlive-formats-extra texlive-latex-base texlive-latex-extra texlive-latex-recommended texlive-pictures texlive-plain-generic texlive-science texlive-xetex 16 17 ``` 18 * Install LaTeX language packages: 19 ```bash 20 apt install texlive-lang-english texlive-lang-french texlive-lang-german 21 ``` 22 * Install used fonts packages: 23 ```bash 24 apt install texlive-fonts-extra texlive-fonts-extra-links texlive-fonts-recommended texlive-font-utils 25 ``` 26 * Install used build environment packages: 27 ```bash 28 apt install latexmk 29 ``` 30 * Install used converter packages: 31 ```bash 32 apt install inkscape libcanberra-gtk-module 33 ``` 34 ### LaTeX GUI Editor 35 * [LaTeXila](https://wiki.gnome.org/Apps/GNOME-LaTeX) -- editing TeX files (Linux only) 36 ```bash 37 apt install latexila 38 ``` 39 * [TexStudio](https://www.texstudio.org/) -- editing TeX files (an alternative to LeTeXila) 40 ```bash 41 apt install texstudio 42 ``` 43 ## Windows Users 44 ### Windows Users 45 * MikTeX (LaTeX package manager for Windows) 46 * https://miktex.org/download 47 * Install latexmk 48 * If it’s not installed already, open the MikTeX Package Manager and install the `latexmk` package. 49 * Install perl for latexmk 50 * (recommended) https://strawberryperl.com/ 51 * (alternative) https://www.perl.org/ 52 * Install TeXStudio (Multi-platform -> chose appropriate installer) 53 * https://www.texstudio.org/ 54 * The LaTeX package "svg" uses inkscape to include and convert svg files on-the-fly. Download and install inkscape. 55 * https://inkscape.org/release/inkscape-1.0.2/ 56 * (Hint) If inkscape installation path is missing, add it i.e. to the environment variable "path".. 57 * https://tex.stackexchange.com/questions/473994/svg-and-inkscape 58 59 ## OS X Users 60 * MacTeX (LaTeX package manager for OS X) 61 62 * http://www.tug.org/mactex/ 63 * Install latexmk 64 * It’s probably already installed. If not, open “TeX Live Utility”, search for “latexmk” and install it. If you prefer using the Terminal:. 65 ```bash 66 sudo tlmgr install latexmk 67 ``` 68 * Install TeXStudio (Multi-platform -> chose appropriate installer) 69 70 * https://www.texstudio.org/ 71 * The LaTeX package "svg" uses Inkscape to include and convert svg files on-the-fly. Download and install Inkscape. 72 73 * https://inkscape.org/release/inkscape-1.0.2/ 74 * (Hint) If Inkscape installation path is missing, add it i.e. to the environment variable "path".. 75 76 * https://tex.stackexchange.com/questions/473994/svg-and-inkscape 77 78 ## All Platforms -- TeXStudio Settings 79 80 Use the LaTeX GUI tool and open the main document "reportTitle.tex". Apply the settings given below when you start TeXstudio the first time. There is a file deployed with the template called ".latexmkrc" which holds some default settings. The settings are used to build the report because the selected build system will be "Latexmk". Using Latexmk has several advantages and builds on the same way whether you use the CLI or the GUI approach. 81 82 1. Open the configuration window *Options* -> *Configure TeXstudio* 83 2. Go to *Build* -> Change Default Compiler to *latexmk* and Default Bibliography Tool to *BibTeX* 84 3. In the bottom left corner, activate -> *Show Advanced Options* 85 * Build Options: Add as additional search paths **Log File** -> *_build* 86 * Build Options: Add as additional search paths **PDF File** path -> *_build* 87 88 When you applied the configurations as described above you are ready to use the template. Use fancy buttons to edit and build the LaTeX report. For further details about the GUI tool read the reference and/or user manual. 89 90 ## CLI Usage (latexmk) 91 If you use cross-references, you often have to run LaTeX more than once, if you use BibTeX for your bibliography or if you want to have a glossary you even need to run external programs in-between. 92 93 To avoid all this hassle, you should simply use [Latexmk](https://personal.psu.edu/~jcc8/software/latexmk/)! 94 95 Latexmk is a Perl script which you just have to run once and it does everything else for you ... completely automatically. 96 97 98 Follow the instruction given below for a first test drive with Latexmk using the CLI. See the online reference of Latexmk for further information. 99 100 Replace "FILE" with the name of the main file. To build the template use "projectReport" in place of "FILE" 101 102 #### Running Latexmk 103 * In the simplest case you just have to type 104 ```bash 105 latexmk 106 ``` 107 *This runs LaTeX on all .tex files in the current directory using the output format specified by the configuration files.* 108 109 * If you want to make sure to get a .pdf file as output, just mention it: 110 ```bash 111 latexmk -pdf 112 ``` 113 * If you want to use latex instead of pdflatex but still want a .pdf file in the end, use 114 ```bash 115 latexmk -pdfps 116 ``` 117 * If you want to compile only one specific .tex file in the current directory, just provide the file name: 118 ```bash 119 latexmk myfile.tex 120 ``` 121 * If you want to preview the resulting output file(s), just use 122 ```bash 123 latexmk -pv 124 ``` 125 * And now the Killer Feature: If you want Latexmk to continuously check all input files for changes and re-compile the whole thing if needed and always display the result, type 126 ```bash 127 latexmk -pvc 128 ``` 129 Then, whenever you change something in any of your source files and save your changes, the preview is automatically updated. But: This doesn’t work with all viewers, especially not with Adobe Reader. See the section about configuration files below for setting a suitable viewer application. 130 131 * Of course, options can be combined, e.g. 132 ```bash 133 latexmk -outdir=_build -pdf -pv myfile.tex 134 ``` 135 136 #### Cleaning Up 137 * After running LaTeX, the current directory is contaminated with a myriad of temporary files; you can get rid of them with 138 ```bash 139 latexmk -c 140 ``` 141 * Previous command doesn’t delete the final .pdf/.ps/.dvi files. If you want to delete those too, use 142 ```bash 143 latexmk -C 144 ``` 145 146 #### Configuration Files 147 *To customize some latexmk build setting such as the default viewer for the preview, edit the file ".latexmkrc".* A snippet with some good pre-configurations for latexmk is given below. 148 149 ```bash 150 cat << "EOF" > .latexmkrc 151 ## 152 ## Adapt previewer settings 153 ## 154 #$dvi_previewer = 'start xdvi -watchfile 1.5'; 155 #$ps_previewer = 'start gv --watch'; 156 #$pdf_previewer = 'start evince'; 157 158 ## 159 ## EPS to PDF conversion hook 160 ## 161 @cus_dep_list = (@cus_dep_list, "eps pdf 0 eps2pdf"); 162 sub eps2pdf { 163 system("epstopdf $_[0].eps"); 164 } 165 166 ## 167 ## Set default TeX file 168 ## 169 #@default_files = ('reportTitle.tex'); 170 171 ## 172 ## Latexmk build properties 173 ## 174 $pdf_mode = 1; 175 $bibtex_use = 1; 176 $latex = 'latex -interaction=nonstopmode -shell-escape'; 177 $pdflatex = 'pdflatex -interaction=nonstopmode -shell-escape'; 178 179 ## 180 ## Build directory 181 ## 182 $out_dir = '_build'; 183 184 ## 185 ## Post process hooks (Linux, OS X only; For Windows install used CLI tools) 186 ## 187 ## Copy PDF to a sub directory named "_output" 188 #$success_cmd = 'mkdir -p _output && cp _build/*.pdf _output/'; 189 ## Copy PDF to a sub directory named "_output" and create a link from top level to the PDF file 190 #$success_cmd = 'mkdir -p _output && cp _build/*.pdf _output/ && ln -s _output/%R.pdf'; 191 192 ## 193 ## List of file extensions to clean up 194 ## 195 $clean_ext = '%R.aux %R.dvi %R.log %R.out tex~'; 196 $clean_full_ext = 'bbl synctex.gz'; 197 EOF 198 ``` 199 200 ## Further Reading 201 * [KOMA-Script Documentation](https://mirror.foobar.to/CTAN/macros/latex/contrib/koma-script/doc/scrguien.pdf) 202 * [KOMA-Script HTML Doc Dir](https://mirror.foobar.to/CTAN/macros/latex/contrib/koma-script/doc/) 203 * [Sci-Hub](https://sci-hub.st/) 204 * [Document Structure](https://psychology.ucsd.edu/undergraduate-program/undergraduate-resources/academic-writing-resources/writing-research-papers/research-paper-structure.html) 205 206 * [Google Scholar](https://scholar.google.com/) 207 208 #### Information about citation style in engineering/science 209 210 * [IEEE Xplore](https://ieeexplore.ieee.org/Xplore/home.jsp) 211 212 #### Information about citation style in medicine 213 214 * [Pub-Med](https://pubmed.ncbi.nlm.nih.gov/) 215