Outils pour utilisateurs

Outils du site


issue126:tutoriel1

Ceci est une ancienne révision du document !


An excellent resource for all LaTeX users – that does not get the attention that it deserves – is the journal of the TeX Users Group TUGboat. You do not have to be a member of the TeX Users Group (TUG) to get it, but, if you want to read the latest edition that is hot off the press, you have to be a member of TUG. Back issues are a free download from the TUG website – https://www.tug.org/tugboat/. I joined TUG when the TUG annual convention came to Toronto last year, and I regret that I did not join TUG earlier. Some of the active members of the TUG are what we would call the top TeX gurus, who have years of experience and knowledge that go back to the very beginning of TeX/LaTeX. It was within the pages of TUGboat that I read about a major flaw in the way we compose with LaTeX.

In life, there are things we do that we call a “best practice“, and often they are easy to identify. When it is a best practice to not do something, it can be difficult to identify, especially when we can get away with doing it so often. In the editorial comments of Barbara Beeton in TUGboat 38:1, Barbara points out a bad practice that many of us are guilty of, and that can be found in online tutorials produced by experienced users of LaTeX. New users are learning this bad practice. I know I did.

What is the bad practice that many of us are guilty of? It is the practice of ending paragraphs with a

There is good news and bad news; the good news is that this practice will not crash your document, but the bad news is, as Barbara Beeton stated “Prejudice against this practice is not just personal bias; the learners are being taught some things that could get them in trouble later on.”

Further research uncovered an earlier posting on https://tex.stackexchange.com where Barbara Beeton said: There is absolutely no advantage to using
to end a paragraph, and in fact, a big disadvantage – it doesn't actually end the paragraph; it only goes to a new line, and probably triggers an underfull line report in the log.

There are only two ways to end a paragraph in “basic” text mode: a blank line, or \par. There are some (but few, and mostly obscure) situations in which \par shouldn't be used. but it definitely puts something “visible” in the file, and if you are sending a file using a mailer that swallows or “disappears” blank lines, then \par is safer.

Never try to end a paragraph with \\!

Frank Mittelbach says: It is wrong because you are using the visual result of one construct to produce the appearance of a different one. A paragraph logically https://tex.stackexchange.com/questions/74353/what-commands-are-there-for-horizontal-spacingends with an empty line. How it is formatted is a question of style, and if you prefer non-indented paragraphs with some space between them, this could be adjusted simply by a declaration and wouldn't need \noindent in front of every para and
at its end. This way, reusing your text is nearly impossible. Even just moving text around means adding and deleting such commands all over the place. https://tex.stackexchange.com/questions/66495/best-choice-between-using-or-leaving-space-after-each-paragraph-to-end-the-pa

Now, we know what is a bad practice, and a good practice. It is clear that whenever we want to make a new paragraph, we should place a blank line in our document. Not only it is all we need, it makes our code much cleaner and neater. I have always preferred a blank line between paragraphs, and now I know it is the best practice to follow.

LaTeX gives us the ability to place items on the page with far more accuracy than what is possible with any word processor. There are other commands that we may use for the control of space.

The command \newline will result in a new line in the paragraph, this line is not indented, making it more suited for an address label, or something you may want to list without the use of bullets or numbers. It does take longer to type this command, but I do not believe that I will require it that often.

The command \newpage does as it says, nothing to it really, no other commands to enter, comes in handy sometimes.

Vertical space is managed with these commands; \smallskip \medskip \bigskip and \vspace{<dim>}

The command \vspace{5mm} will push the sentence, table or graphic that follows it 5 mm below the line that is above the command. Any units-of-measure can be used: metric, points, or inches. In a LaTeX document, you can use any combination of units of measure. You can use inches in one command, and then points or centimeters on the next command. Within LaTeX, we are not tied to a unit-of-measure like we are in a word processing document. This is what gives us incredible control with the placement of tables, graphics and text in the document.

Horizontal space can be managed the same way with the \hspace command. The other commands are handy when you do not have to be too precise and just want some extra white space.

There are more commands than these, but these are the main ones that give us incredible control over how our creations look. Use the double slash when necessary, but do not use it constantly.

Help on this topic is only an Internet search away – with https://tex.stackexchange.com being one of the best places to click on. In fact, you will find answers there from the gurus in TUG, but do not forget to check out the https://www.tug.org site where you can find TUGboat and so much more.

Many thanks to Barbara Beeton, Editor of the TUGboat, for her assistance in the writing of this article.

issue126/tutoriel1.1509297531.txt.gz · Dernière modification : 2017/10/29 18:18 de auntiee