2099-06-10-on-old-software.md (1659B)
1 --- 2 layout: post 3 title: "On Old Software" 4 toc: false 5 image: https://en.wikipedia.org/wiki/Vi#/media/File:Vi_source_code_join_line_logic.png 6 categories: 7 - AI for MDs 8 tags: 9 - coding 10 - software 11 - history 12 - laziness 13 - groff 14 - latex 15 - vim 16 - gopher 17 --- 18 19 a later date.[^4] 20 21 # Typesetting 22 23 # Text editing 24 25 # Internet 26 27 28 [^6]: You may have noticed that the name of this file is "results_paragraphs_latex.txt" rather than "results_paragraphs.txt," and that's because LaTeX needs a little special treatment if you're going to use the percentage symbol. LaTeX uses the percentage symbol as a comment sign, meaning that anything after the symbol is ignored and left out of the document. You have to "escape" the percentage symbol with a slash, like this: `\%`. I have this simple bit of code that converts the normal text file into a LaTeX-friendly version: 29 30 ```python 31 # make a LaTeX-friendly version (escape the % symbols with \) 32 # Read in the file 33 with open(results_text_file, "r") as file: 34 filedata = file.read() 35 # Replace the target string 36 filedata = filedata.replace("%", "\%") 37 # Write the file 38 text_file_latex = "results_paragraphs_latex.txt" 39 with open(text_file_latex, "w") as file: 40 file.write(filedata) 41 ``` 42 43 [^7]: You may have noticed there are two datasets I'm pulling from for this, "data," which includes everything on the basis of _hospitalizations_, and "df," short for "dataframe," which is a subset of "data" that only includes each _patient_ once (rather than a new entry for every hospitalization), along with a few other alterations that allow me to do patient-wise calculations.