Hot answers tagged

45

In none of the presented cases you should use \mbox. Phone numbers should use a kern, such as 123\,456\,7890 Things such as p.~210~sq.\@ should use a tie (note the \@ in order not to make the period as a sentence ending one) Names should use ~: Jean de~La~Fontaine (you may want to remove the first ~ if line breaking becomes otherwise unfeasible) Space ...


21

The \mbox is totally unbreakable, i.e., it does not allow hyphenation nor any other breaks. The tilde ~ inserts an unbreakable space, but does not affect the breakability of its left and right neighbours. So in La~Fontaine the Fountaine part can still be hyphenated. So, the tilde is easier to type and to read in the TeX source and it has the other ...


11

EDITED to work with all sizes of a given font. EDITED to take hooy's suggestion of calling it \?. \documentclass{article} \usepackage{trimclip} \def\?{\setbox0=\hbox{?}\raisebox{.2\ht0}{\clipbox{0pt .2\ht0 0pt -.1\ht0}{?}}} \begin{document} Is this is a test\? of something? \Huge ?\? \end{document}


7

The idea of clipping is good; it's not necessary to guess, since we can use the height of the period for deciding how much to clip. In order to take care of the overshoots, it's necessary to work a bit harder: the clipping is done 10% higher than the period and the bounding box is similarly increased by 10% at the top. The bounding box is then reset using ...


7

For example, you can remove the dot by white rectangle with height of dot. \input opmac \def\nodot#1{\setbox0=\vbox{\kern.01em\hbox{.}\kern.01em}\setbox1=\hbox{#1}% #1\kern-\wd1{\localcolor\White \vrule height\ht0 width\wd1}} Aha \nodot? next text? \end Edit I don't understand why my answer is ignored here. The question was not LaTeX specific so my ...


5

There are different classes of mathematical symbols in LaTeX, as discussed in this question: What is the difference between \mathbin vs. \mathrel? Depending on the class of a math symbol, surrounding space will be modified in predictable, relevant ways. The comma is of the type \mathpunct (mathematic punctuation) which, when surrounded by math atoms, ...


5

Some suggestions: By all means, load the fontenc package with the option T1. Consider loading the csquotes package with the option french=guillemets, in addition to loading the babel package with the option french. Then, write \enquote{C'est Ulysse!} and let LaTeX handle the exact positioning of the quote marks. Don't write \(26^e\) épisode in the ...


5

Typing << for « and >> for » is provided only if you load the T1 encoding. \documentclass[12pt]{article} \usepackage[T1]{fontenc} \usepackage[utf8]{inputenc} \usepackage[french]{babel} \begin{document} \title{Test ULysse} \author{} \date{} \maketitle \section{26\ieme{} épisode Où Achille...} Il dit : << C'est Ulysse ! >> ... ...


4

Indeed, use the fontenc package with the T1 option, and for more typographically correct results you can use the \og and \fg commands of the Frenchb extension (which provides the french option of babel). However, I think like egreg that the best way to enter French guillemets is to enter those guillemets directly, without having to enter \og or \fg nor ...


4

Switch There is already a switch, \ifexport, which can be used: x = y\ifexport\else.\fi Or a macro can be defined, depending on switch \ifexport: \documentclass{article} \newif\ifexport %\exporttrue \ifexport \RequirePackage{mathtools} \mathtoolsset{showonlyrefs} \RequirePackage[active,tightpage]{preview} \PreviewEnvironment{equation} ...


4

LaTeX answer Never ever use $$ in LaTeX; see Why is \[ ... \] preferable to $$ ... $$? Of course, loading amsmath is recommended, so the equation can be typed in as \documentclass{article} \usepackage{amsmath} \begin{document} \begin{equation*} E=mc^2+\dots+\frac{GmM}{r^2}+\dotsb. \end{equation*} \end{document} Note that you have to help LaTeX and ...


2

I have discovered that in LyX I have to put the minted part of the file into a [ctrl]+[L] box. Only then does it work.


2

You can use the icomma package. But you must then ensure that you input a space after a comma if you want a space: \documentclass[]{article} \usepackage{icomma} \begin{document} $(a, b, c) = f(x, y) $ $(a,b,c) = f(x,y) $ %wrong $100,000$ \end{document}


1

Here's a LuaLaTeX-based solution. It adds the instruction \directlua{do_something=true} to the \ifexport clause and provides a Lua function called remove_trailing_punct which -- if \ifexport is "true" -- removes punctuation marks that occur at the ends of lines inside equation[*] and align[*] environments. Commas, periods ("full stops"), and semicolons, are ...



Only top voted, non community-wiki answers of a minimum length are eligible