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.

Une excellente rssorce pour tous les utilsateurs de LaTeX - qui ne reçoit pas l'attention qu'il mérite - est le journal du groupe des utilisateurs TeX TUGboat (Tex Users Group TUGboat). Vous n'avez pas à être membre du groupe des utilisateurs TeX (TUG) pour l'obtenir, mais, si vous voulez lire la dernière édition qui vient de sortir, vous devez être membre du TUG. Les numéros précédents sont en téléchargement libre depuis le site du TUG - https://www.tug.org/tugboat/. J'ai rejoins le TUG quand la convention annuelle du TUG est venue à Toronto l'an dernier et je regrette de ne pas les avoir rejoint plus tôt. Certains membres actifs du TUG ssont ce que nous pourrions appeler la crême des gourous du TeX, avec des années d'expérience et connaissance qui remontent au premier pas de Tex/LaTeX. C'est dans les pages de TUGboat que j'ai appris la principale faiblesse dans la façon dont nous composons avec LaTeX.

Dans la vie, il y a des choses que nous faisons en les appelant des « best practices » (les meilleures façons de faire) et elles sont souvent faciles à identifier. Quand c'est une « best practice » de ne pas faire quelque chose, ce peut être difficile à identifier, spécialement quand nous pouvons éviter de la faire aussi souvent. Dans les commentaires éditoriaux de Barbara Beeton, dans le numéro 38:1, Barbara montre une mauvais pratique dont beaucoup d'entre nous sont coupables et que nous pouvons trouver dans les tutoriels en ligne réalisés par des utilisateurs expérimentés de LaTeX. Les nouveaux utilisateurs apprennent cette façon de faire. Je sais que je l'ai fait.

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.

Quelle est donc cette mauvaise pratique dont beaucoup ont coupables ? C'est l'habitude de terminer les paragraphes avec un

Il y a une bonne et une mauvaise nouvelle ; la bonne est que c'est façon de faire ne plante pas votre document, mais la mauvaise est, comme l'écrit Berbara, que « le préjudice contre cette pratique n'est pas qu'une déviance personnelle ; les apprenants à qui on enseigne de telles choses risquent d'être mis devant un problème plus tard. »

Par une recherche approfondie, on découvre un message plus ancien sur https://tex.stackexchange.com dans lequel Barbara dit : Il n'y a aucun avantage à utiliser
pour finir un paragraphe, mais, en fait, un gros désavantage – il ne finit pas vraiment le paragraphe ; il amène à une nouvelle ligne et, probablement, déclenche une ligne de rapport pour « Underfull » (ligne incomplète) dans le log.

Il n'y a que deux façons de terminer un paragraphe dans le mode de texte « de base » : une ligne vierge ou \par. Il y a quelques situations (peu nombreuses mais plutôt obscures) dans lesquelles \par ne devraient pas être utilisées. Mais cela met quelque chose de vraiment visible dans le fichier et, si vous envoyez un fichier avec une messagerie qui oublie ou fait disparaître les lignes vierges, alors le \par est plus sûr.

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.

N'essayez jamais de terminer un paragraphe avec
!

Frank Mittelbach dit : C'est faux car vous utilisez le résultat visuel d'un construction pour en produire une différente. Un paragraphe se termine logiquement avec une ligne vide. https://tex.stackexchange.com/questions/74353/what-commands-are-there-for-horizontal-spacing Comment elle est formatée est une question de style et, si vous préférez des paragraphes non indentés avec un peu d'espace entre eux, ceci peut être adapté simplement avec une déclaration et sans avoir besoin de \noindent au début de chaque paragraphe et
à la fin. Avec cette façon, votre texte n'est pratiquement pas réutilisable. Même le simple déplacement du texte oblige à ajouter et effacer de tels commandes à pleins d'endroits. https://tex.stackexchange.com/questions/66495/best-choice-between-using-or-leaving-space-after-each-paragraph-to-end-the-pa

Maintenant, nous savons ce qu'est une mauvaise pratique et une bonne pratique. C'est clair que chaque fois que nous voulons faire un nouveau paragraphe, nous devrions mettre une ligne vierge dans notre document. Nous nous en avons besoin, mais ça rend le texte plus propre et plus soigné. J'ai toujours préféré une ligne vierge entre les paragraphes et, maintenant, je sais que c'est la façon pratique à suivre.

LaTeX nous donne la possibilité de placer des éléments dans une page avec une précision bien meilleure qu'avec n'importe quelque traitement de texte. D'autres commandes sont possibles pour la maîtrise des espaces.

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.1510385278.txt.gz · Dernière modification : 2017/11/11 08:27 de d52fr