Posts

Showing posts with the label Python

Study on an example of integration between Python and LaTeX

Image
Table of Contents 1. Subject of this article. 2. Description of the steps without using Python. 3. Python file content. 4. Program analysis. 5. Source in LaTeX generated by Python. 6. To try the program. 1. Subject of this article. I am not a computer scientist but I have been using LaTeX for over ten years to write court documents. Only a few months ago I started to follow some tutorials on programming with Python. I immediately wondered if LaTeX and Python could interact with each other. So I asked Gemini to generate a source in Python for that purpose. The structure of the program in Python is as follows: an array consisting of 5 columns and 10 rows of random numbers is generated, and a LaTeX language document containing the newly generated array is created. Although the code is generated by Gemini, the observations and analysis are my own. The study was fully conducted on GNU/Linux operating systems , mostly Arch Linux. 2. Description ...

A Python program to copy text from various PDFs and collect it into a single document in Markdown language.

Image
1. Subject of this article. 2. Python source analysis. 3. The full source code in Python. 1. Subject of this article. The goal is to generate a simple program to collect the text contained in various PDFs generated directly from word processing programs and insert the various fragments into a single document in Markdown language by separating the fragments with second-level headings corresponding to the name of the source documents. The "hands-on" solution is to copy the text from the individual documents, one by one, and paste it into a second document. Or you could build a simple application in Python that does all the work automatically, saving an amount of time directly proportional to the number of documents to be processed. The script , generated with the help of Copilot ( because I am not a programmer), requires the installation of the PyPDF2 library. Warning: this article does NOT discuss optical character recognition (OCR). For that topic, yo...

Reducing the size of single or multiple PDF documents in GNU/Linux Bash and Python

Image
Abstract : Compression of PDF documents is a useful technique to reduce the space occupied by these files and facilitate their transmission and storage. In this article, starting from a page devoted to compressing single PDFs, I present two methods for compressing multiple PDF documents. The reference page is as follows: " Linux shell script to reduce PDF file size (simple verification required to enter) and allows you to operate on single PDFs in command-line bash code in the GNU/Linux terminal. Based on the previous one, I tried to extend the procedure to operate on multiple PDFs. In the end I present a simple application in Python with graphical interface. I admit that I asked for some help from ChatGPT and Copilot. Table of Contents: 1. The necessary condition. 2. The reference script for size reduction of individual PDFs 2.1. Script analysis and usage. 3. Derived script to operate on multiple PDFs. ...