I'd like to print out two minus signs just after each other, like this -- (as in the C operator to subtract one). Doing -- gives one longer - sign. I've tried \char"2D\char"2D but that also just gives one longer - sign. How can this be done?
Asked
Active
Viewed 472 times
3
2 Answers
9
Clara
- 6,012
-
2Note:
-{}-does not work with LuaLaTeX. There you would have to use something like-\kern0pt-or-\/-instead. – cabohah Mar 29 '23 at 11:27 -
1
-
-
1
-
1@baldanders777, if that‘s what you were looking for, please accept the answer to raise Clara‘s reputation ;-) – MS-SPO Aug 06 '23 at 09:29
1
So I agree with the @Clara's answer but I want to explain the reasons or the workings a bit.
As you already may have noticed, - produces a single minus. This is the same minus which would be used in hyphenations.
Adding a second minus -- is the latex shortcut for an en-dash and --- produces an em-dash. Both of these are used to typeset interjected sentences -- like this one -- or abrupt stops.
In order to generate two separate minuses
-- as in the above answer -- the command -{}- should be used. Here an empty scope is opened in between the two minuses. This stops LaTeX from joining them into an en-dash. The scope evaluates to nothing so there is no actual space added in between the minuses. The result is just two hyphenation-style minuses.
samcarter_is_at_topanswers.xyz
- 158,329
Oliver Leenders
- 58
- 6
-
The above answer by @Clara (since the position on the page can change). \ In your actual answer (as opposed to your TeX code) you probably want your
--to be a Unicode ‘–’, but maybe the norm here on TeXSE is to use TeX formatting codes even when they aren't rendered. Anyway, grammatically I think you actually want an em dash ‘—’ or ‘---’ where you are using--in text. (It's not exactly covered by the Wiki article, but self-interruption may come close.) \ There is a typo ‘hyphnation’. – LSpice Aug 05 '23 at 20:02 -
I updated my answer. However depending on where you live and what kind of aesthetic preferences you have, you may use either an en-dash or an em-dash. In Germany for example em-dashes are basically never used (but en-dashes with spaces around) whereas in the US it is common to use em-dashes (without spaces around) instead of en-dashes. – Oliver Leenders Aug 11 '23 at 10:31
-
2Maybe to avoid confusion between hyphen and minus:
-in text mode will actually print a glyph called "hyphen-minus" in Unicode. It is the glyph that is used in hyphenation, so, I typically prefer to call it a hyphen. There exists also a minus sign in some fonts which is a bit wider (as wide as a plus sign). In TeX, the equivalent to a minus is what would be typeset with$-$. – Jasper Habicht Aug 11 '23 at 11:00

-{}-, but maybe provide some more information about the context (math mode, verbatim, ...?) – Jasper Habicht Mar 29 '23 at 09:18-in text is a hyphen not a minus sign. In math,$--$does not ligature to a dash – David Carlisle Mar 29 '23 at 09:33listingsorminted, so--wouldn't be a ligature any longer. BTW: Adding a minimal working example would help us to understand the question better and so to help you better. – cabohah Mar 29 '23 at 09:51\lstdefinestylefor larger blocks of code, but I've just changed the font when writing shorter snippets of code that resides within blocks of regular text. However,-{}-did the trick for now. – baldanders777 Mar 29 '23 at 13:02!=,->and the like.--might be part of such a set of ligatures. In this case-{}-would be a temporal workaround. A better way would probably be to disable the ligature in question. However, it depends on the font whether or not this is possible and, if yes, how to do this. – Jasper Habicht Mar 29 '23 at 14:45