TeX - LaTeX Asked by PHPst on March 1, 2021
What is best method to insert an ellipsis in a (Xe)TeX document?
documentclass{article}
usepackage{fontspec}
setmainfont{Times New Roman}
begin{document}
a...b a ... b %or
aldots b a ldots b %or
a…b a … b
$a...b a ... b$ %or
$aldots b a ldots b $ %or
$a…b a … b $
end{document}
Their results seem to be similar.
You can achieve advantages of both (readability and good appearance) using Unicode Character 'HORIZONTAL ELLIPSIS' (U+2026)
If you have installed AutoHotKey use following script to convert ...
to …
automatically:
::...::…
In Windows, it can be inserted with Alt+0133.
In MacOS, it can be inserted with ⌥ Opt+; (on an English language keyboard).
In Linux, it can be inserted with AltGr+.
Correct answer by PHPst on March 1, 2021
Remark -- The answer given below addressed the original version of the posting, which asked if there's an advantage to using ldots
over ...
(three consecutive dots). At some later stage (May 2013?), the posting was changed to ask a different question, viz., what the best method is for inserting a text ellipsis in a (Xe)TeX document. The OP also provided a new answer at the time.
You asked:
Is there any advantage in using
ldots
instead of...
?
Yes! If you type ...
you'll get some rather-closely spaced dots. In contrast, with ldots
the dots are correctly spaced for a typographic ellipsis.
The following MWE illustrates some of the visual differences created by ...
and ldots
. The differences are readily apparent in both text mode and math mode.
documentclass{article}
begin{document}
yes and no ... yes and no ldots yes and no ...
${x_1,x_2,...,x_n}$ vs. ${x_1,x_2,ldots,x_n}$
end{document}
Naturally, if your language is not English -- for which ldots
was designed initially -- you'll want to make sure that the ellipis created by ldots
conforms to your language's typographic conventions. @egreg's comment suggests that this may well be a concern for the French case. For such situations, you may want to use the commands provided by a specialized package such as ellipsis
or csquotes
rather than the "standard" ldots
command.
Addendum prompted by a follow-up question by @moose: In LaTeX, there's also the command dots
. This raises the natural question, what is the difference between ldots
and dots
? The simple answer is: There's no difference in LaTeX. (I'm not sure if this applies to Plain TeX as well; I don't have the TeXbook at hand today...) The definitions of these two commands (from latex.ltx
) are as follows:
DeclareRobustCommand{dots}{%
ifmmodemathellipsiselsetextellipsisfi}
letldotsdots
The textellipsis
instruction, in turn, is defined in the LaTeX kernel as follows:
DeclareTextCommandDefault{textellipsis}{%
.kernfontdimen3font
.kernfontdimen3font
.kernfontdimen3font}
Answered by Mico on March 1, 2021
I suggest using ldots
in combination with the package ellipsis, because that gives you better control over spacing than ...
. Using ldots
alone (without ellipsis
) is better than ...
because it gives you more flexibility. For example, you may redefine the spacing by redefining ldots
. On the other hand, ellipsis
makes it easy to fine tune spacing, and takes care of other spacing problems, for example to combine ellipsis with full stop (....).
If you want to fine tune ellipsis, you easily change the distance between the dots by the command:
renewcommand{ellipsisgap}{0.1em} % or another value
By adding the option [xspace]
, i.e.
usepackage[xspace]{ellipsis}
terminating the ldots
-command by is not necessary (but even
xspace
makes errors, as documented in the manual). If you use ellipsis
, remember to load it after hyperref
.
The package csquotes has the commands
textelp{}
textelp{<text>}
textelp*{<text>}
that fill similar functions as ellipsis
and give you the tools for automatically handle exception from the rules. Therefore, they are better solutions than ...
.
I recommend using ldots
with ellipsis
(or substitutes), which give best control over spacing, more flexibility and typographical consistency in more situations.
Answered by Sveinung on March 1, 2021
Get help from others!
Recent Answers
Recent Questions
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP