4

I want insert some symbols like A' and "BACK" in certain parts of the document.I tried to do it by A\' and \"BACK\" but returned with errors. How to insert this extra symbols The next problem is hoe to write -0.8.whenever i am inserting an -ve symbol it just disappears.I am trying to write

${−0.8 \le k \le 0.8}$.

but the -ve symbol is not appearing

DJs
  • 105
  • Could you explain a bit more what you are trying to do and maybe post the code you've tried? Do you mean that you literally want just straight quotation marks? If you load the textcomp package, you can type e.g. A\textquotesingle, \textquotedbl BACK \textquotedbl and \textquotestraightbase and \textquotestraightdblbase, for example. – cfr Jan 05 '14 at 02:59
  • Don't wrap the math content inside a group {...}, unless you know what it's all about. – Werner Jan 05 '14 at 03:37

2 Answers2

2

The Initial Question

\documentclass{article}

\usepackage[T1]{fontenc}
\usepackage{textcomp}

\begin{document}

A\textquotesingle

\textquotedbl BACK\textquotedbl

\bigskip

And even\bigskip

A\textquotestraightbase

\textquotestraightdblbase BACK\textquotestraightdblbase

\end{document}

straight quotation marks with textcomp

The Number Question

I am not sure what you mean about the -ve symbol disappearing. If I write -0.8 that's what it typesets. However, since this is a number you may want to type $-0.8$ which will format it accordingly:

\documentclass{article}

\begin{document}

-0.8

$-0.8$

\end{document}

Note the difference:

numbers as text vs. numbers as maths

Updated Question

You just need to make sure you are inputting the correct character as minus. Note the difference:

\documentclass{article}

\begin{document}

This is your code which I just cut and pasted:

${−0.8 \le k \le 0.8}$.

Here is some in which I just retype the minus sign:

${-0.8 \le k \le 0.8}$.

or

$-0.8 \le k \le 0.8$.
\end{document}

non-minus vs. minus sign

Note that the second form is better - see Werner's comment above.

cfr
  • 198,882
  • i appreciate your help.first problem solved.the second problem still remains.I have updated the question.Please take a look at that – DJs Jan 05 '14 at 03:24
  • You are not typing a minus sign. When I copy and paste your code, it disappears. But if I delete your non-minus and just type a new one using the regular key on my keyboard, it shows up just fine. How did you get that symbol? Maybe your keyboard is somehow sending the wrong keycode? – cfr Jan 05 '14 at 03:38
  • bingo....it works...i dont know what is wrong with my LAPTOP..thank you.. – DJs Jan 05 '14 at 03:49
  • If you add \usepackage[utf8]{inputenc} in your preamble, you'll get an actual error which is at least more informative than it simply disappearing! You might check your editor configuration - maybe it is automatically replacing - with another symbol? Not really sure what might be going on. – cfr Jan 05 '14 at 04:00
2

For the problem with quotes, using \textquotesingle and \textquotedbl from textcomp is a solution. For the minus sign, you have two strategies.

  1. Simply type a hyphen, which in math mode is interpreted as a minus sign

  2. Use U+2212 MINUS SIGN, as you're doing (and the symbol disappears), but loading inputenc and newunicodechar

For strategy 1 nothing is necessary, just search and replace. For strategy 2, here's what you can do:

\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage{newunicodechar}

% The first is U+2212 (minus sign),
% the second is U+002D (hyphen-minus)
\newunicodechar{−}{-}

\begin{document}

$−0.8 \le k \le 0.8$.

\end{document}

The \newunicodechar instruction is needed, because the utf8 doesn't enable a definition for it. In this way, any U+2212 character will become a hyphen or minus sign, depending whether it's found in text or math mode.

If you want to be warned when U+2212 is used in text mode, which it shouldn't, then change the simple \newunicodechar instruction with

\makeatletter
\DeclareRobustCommand{\hyphenorminus}{%
  \ifmmode\else\@latex@warning{Minus sign in text mode}\fi-}
\makeatother
\newunicodechar{−}{\hyphenorminus}

Why did the minus sign disappear? The UTF-8 realization of U+2212 is the three byte combination <E2><88><92> and the seven bit math fonts have nothing in those slots.

egreg
  • 1,121,712