Outils pour utilisateurs

Outils du site


issue167:tutoriel1

Ceci est une ancienne révision du document !


Website: https://www.latex-project.org/ Prerequisites: A willingness to learn. Target audience: N00bs My uncle was a typesetter for a small town newspaper. Though it fascinated me, it did not seem very difficult or something I would ever want to do. It was weird to watch, all the backwards letters and infinite arranging. The only printing I ever did, was a small parody newsletter on a dot matrix printer for a few of my friends. Though it was received well, ribbons were extremely expensive, and my little printer would eat ribbons, to the extent where I would buy ink at a 100th of the price of a ribbon and “fill” it by wetting and winding the ribbon through. You could only do that once or twice before the ribbon would wear out. So printing was never my forte and, as such, it never bothered me. Fast forward to the year 2014 and I had to support a client who used Latex (poor souls thought Red Hat WAS linux!). Though even today, I still consider myself a beginner, I was dropped into the deep end and made lots of mistakes. I thought it may be good for others to learn from my mistakes.

There are a lot of Latex applications in Linux, simply type latex in the search bar of your software centre. I am going to use “TeXstudio”; it’s like an IDE for Latex, but the second name of Linux is choice, so use what makes you happy. I suggest you use it to follow along, and once you get the hang of it, you can use your favourite latex application. The reason I am suggesting TeXstudio is because, like an IDE, it gives hints and “code completion”. This is an immense help. Let’s get started. Open TeXstudio and you will be presented with a blank interface. Don’t worry, I will take you through it. Like many programming IDEs, TeXstudio is laid out in 3 big panes. If you have used an IDE before, you will know that it is sort of like your file browser, with an output window at the bottom. However, you need to know certain “commands”, and I don’t know how to ease you into it, other than letting you do it. Monkey see, monkey do…

The catch with TeXstudio is that you can’t type where you need to, until you press CTRL+N or click the “New” button. Open a new empty document with the above method. I was thinking of making a lost pet poster (something simple), but I realise most people will want to do some text work first. Also, the closest I have to a pet at the moment, is the roof rat in my ceiling that is eating me out of house and home. Apparently, he likes the rat poison I put out, as he eats it all in one go. If it makes him sick, he probably has better medical aid than me too, as he is always back for more. *Le Sigh… In the empty document, type \d and peruse the drop-down menu, to get an idea of how busy it can get. Feel free to type other letters after the “\” to peruse the drop-downs, and see why I thought this was an application for Sadists. Select: documentclass {keyvals} {class}.

Now for some substitution, replace the word “keyvals” with “a4paper”, and the word “class” with “article”. This is a magazine and we are going to make an article. You do this by double-clicking the word you want to replace and it should highlight, then just type the word you need. Go to a new line. This part is important. Almost every Latex document needs this. Type \begin and hit enter. The IDE will fill in the \end for you (see above). Just like before, we are going to substitute the “*environment-name*” with our own. In our case, it will just be “document”. Within our document boundaries, we will nest our article (see below). The keys you need to get familiar with are F6 and F7. F6 will compile your document, F7 will display it in preview mode. F5 is the key you use if you have a wide monitor, as it includes F6 & F7.

TeXstudio does not save your document automatically when you compile it. Save often. Okay, now to “redpill” you. Your official “need-to-know” is here: http://tug.ctan.org/info/symbols/comprehensive/symbols-a4.pdf However, I find it ugly, with all the blocks, so here is a clean version: http://math.mit.edu/~dspivak/files/symbols-all.pdf Download it and keep it for reference. Now a quick word on what we did. A documentclass refers to a “class”, or recipe, or blueprint. Let’s imagine that to be bread. We can have white bread, we can have whole wheat bread, we can have rye bread. But - all of them are bread. They are all the same, but different, ie. they share characteristics. At the moment, I don’t want us to be caught up in jargon, but it may look strange to someone who has never used an IDE before.

People have written books in Latex, so it is not for documents only. Let us look at adding your particulars to a document. Add the following lines to your document, compile it and preview it: What happened? Nothing? Are you sure? Because we added our title and author outside our main body, it was recorded, but not printed. Be aware of the beginning and end. (Luckily for us, Latex has a built-in command to take care of the little things, but more on that after this). The best way I can describe using latex is that it is like cooking a meal. If you set out all your ingredients first, then do the measurements beforehand, the experience of using it will be much smoother. Let me demonstrate, add the following to your document, and compile and run it: \maketitle will now make a title in a large font, add your author and today’s date. Handy, no?

A quick word on layout, The reason we type it all out, one line after another, is for readability and for finding errors. The IDE will put red marks next to the line containing the error in the margin. That said, the following is just as valid: Lots of educational institutions have guides on using Latex. Why we are doing this, is because sometimes it is easier when there are pictures and sometimes we just need someone to whip out the crayons. A document by a professor, for a professor, is like eating dry dog biscuits for a beginner. Did we make a mistake? Do you know a better way? Why not let us know at: misc@fullcirclemagazine.org We would love to hear from you.

References: https://www.dailykos.com/stories/2015/1/15/1357854/-Self-publishing-101-Using-LaTex-to-create-a-beautiful-book https://www.oreilly.com/library/view/latex-beginners-guide/9781847199867/ch03s02.html http://www.docs.is.ed.ac.uk/skills/documents/3722/3722-2014.pdf

issue167/tutoriel1.1617269381.txt.gz · Dernière modification : 2021/04/01 11:29 de d52fr