Text FormattingMinus Sign

Information and discussion about LaTeX's general text formatting features (e.g. bold, italic, enumerations, ...)
Post Reply
latexhelp1
Posts: 141
Joined: Sun Jun 12, 2011 6:30 am

Minus Sign

Post by latexhelp1 »

The minus sign is not working well with the indicator function, defined as follows:

Code: Select all

\newcommand{\indicator}[1]{\mathbbm{1}{\left( {#1} \right) }}
\tau_k 1{\hskip -2.5 pt}\hbox{I}{(x $-$ X_c^{*} = n)}
I would be grateful for any help!

Is $-$ the best way to produce the minus sign?

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

Stefan Kottwitz
Site Admin
Posts: 10345
Joined: Mon Mar 10, 2008 9:44 pm

Minus Sign

Post by Stefan Kottwitz »

In the second line, the definition of the first line is not used.

The second line requires math mode. And if it's in math mode, $...$ is not necessary, you can directly write

Code: Select all

x - X_c^{*} = n
Stefan
LaTeX.org admin
latexhelp1
Posts: 141
Joined: Sun Jun 12, 2011 6:30 am

Minus Sign

Post by latexhelp1 »

Thank you for the clarification! I use package, amsmath, is that what you mean?

How about minus signs in tables? Should I be using the $ notation there? For example, I am trying to align the numbers in the table so I am using

Code: Select all

\usepackage{tabularx}
\noindent\llap{$-$}2.93\rlap{***}

Should I put the $-$ in the llap like such? Should I be doing something else?

And how would I do a minus sign in an a tikz figure?

Code: Select all

\usepackage[T1]{fontenc}
\usepackage{mathptmx}
\usepackage[scaled]{helvet}
\usepackage[font=large,labelfont=bf,tableposition=top,textfont=bf]{caption}
\usepackage{amsmath,natbib,numlscape,varwidth}
\usepackage{hyperref}
\hypersetup{colorlinks=true, linkcolor=red, citecolor=blue, urlcolor=blue, urlbordercolor = {0 1 1}}
ymax                = 0.05,
ymin                = -0.05,
ytick               = {-0.05, -0.04, ..., 0.05}
How can I ensure that the -0.05 will have the appropriate minus sign?
Stefan_K wrote:In the second line, the definition of the first line is not used.

The second line requires math mode. And if it's in math mode, $...$ is not necessary, you can directly write

Code: Select all

x - X_c^{*} = n
Stefan
User avatar
Stefan Kottwitz
Site Admin
Posts: 10345
Joined: Mon Mar 10, 2008 9:44 pm

Minus Sign

Post by Stefan Kottwitz »

amsmath is generally recommendable. That's not what I mean by math mode.

When writing text or symbols in TeX, you can be
  • in text mode: usually letters are upright
  • or in math mode: usually letters are italic (variables), and you can use symbols.
In math mode, - is a minus. In text mode, - is a dash, -- a wider dash, and --- an even more wider dash.

Just make sure, that you are in math mode, when you would like to write a minus. Either you already are, such as in displaymath, equation, or array enviropnments, or within $...$ (which is inline math), or, in text, open math mode for it and write $-$. Usually, a minus is not alone, so the complete expression should be written in math mode, such as $-2.93$ or $-x$.

Stefan
LaTeX.org admin
latexhelp1
Posts: 141
Joined: Sun Jun 12, 2011 6:30 am

Minus Sign

Post by latexhelp1 »

Thank you Stefan for clarifying about math mode! I completely understand minus signs in that context now.

I am unclear about graphs and tables, however, as I had previously asked. The - in the figure looks quite large, more like an en dash or em dash than a minus sign, but when I tried to add $$ to the tick marks, I got a syntax error, I believe. In the table, I just don't know what should be in the \llap{} for a table...

Is it correct, in general, that:
- for hyphen within a word (e.g. Shiloh Jolie-Pitt)
-- for page numbers (e.g. pp. 21--22)
--- for en dash as a punctuation mark (e.g. on p. 3---very early into the book---that was said)
Stefan_K wrote:amsmath is generally recommendable. That's not what I mean by math mode.

When writing text or symbols in TeX, you can be
  • in text mode: usually letters are upright
  • or in math mode: usually letters are italic (variables), and you can use symbols.
In math mode, - is a minus. In text mode, - is a dash, -- a wider dash, and --- an even more wider dash.

Just make sure, that you are in math mode, when you would like to write a minus. Either you already are, such as in displaymath, equation, or array enviropnments, or within $...$ (which is inline math), or, in text, open math mode for it and write $-$. Usually, a minus is not alone, so the complete expression should be written in math mode, such as $-2.93$ or $-x$.

Stefan
latexhelp1
Posts: 141
Joined: Sun Jun 12, 2011 6:30 am

Minus Sign

Post by latexhelp1 »

Hi Stefan,

How do minus signs in BibTeX work? For the page numbers, should there always be two dashes?

For example,

Code: Select all

       
@ARTICLE{lastname,
          author= {Author Name},
          title= {Title},
          journal= {Journal},
          year= {2002},
          volume= {17},
          number= {3},
          pages= {1093-1119},
}

Should the last row be pages= {1093--1119},
Stefan_K wrote:amsmath is generally recommendable. That's not what I mean by math mode.
Stefan
Post Reply