2

This is my first time using LaTeX and I am running into the following issue:

I am trying to denote a set of functions x_t which belong to K but for some reason the entire sentence gets italicized. I have attached screenshots of my code as well as the compiled result. Can anyone help me fix this? Cheers

enter image description here

enter image description here

  • 2
    Welcome! Please paste code here rather than a picture of it - preferably in the form of a small but complete document which we can use to reproduce the issue. – cfr Oct 14 '16 at 1:19
  • 1
    Welcome to the site! Don't worry, you're not the first and you won't be the last :) It's important to understand that some commands can only appear in math mode, such as _ and \mapsto. This is why LaTeX is inserting the missing $ signs, but it's put everything in math mode, hence your problems. The next and most important thing to understand is that $ ... $ shouldn't be used as a way of "mathifying" individual glyphs, or getting special characters, it sets up math mode, which is where the entire equation/relation/expression/object should go, in order to get the right spacing &c. – Au101 Oct 14 '16 at 1:33
7

That code is surely giving you errors when you compile, which will be telling you at least something about the problem. TeX will complain about missing $ signs and add them in, but it can only guess where to put them.

You want everything from f_{t} to \mathbb{R}between one set of $ ... $ and then from x_{t} to the end between another set. f_{t} : etc. is maths and you have it set as text. Similarly, \mapsto etc.

$f_{t} \colon \mathcal{K} \mapsto \mathbb{R}$
...
$x_{t} \in \mathcal{K}$

EDIT Use \colon as suggested by Mico.

|improve this answer|||||
  • 4
    That's OK. But if you paste code we can copy-paste, it is a lot easier to help than giving us a screen shot. – cfr Oct 14 '16 at 1:30
  • 3
    +1. A minor point: Use \colon instead of :. – Mico Oct 14 '16 at 7:53
4

<rant>
As a regular user of Mathematics.SE, I'm really impressed about the poor quality of TeX/LaTeX input. I acknowledge that some compromise with the limited possibilities offered by MathJax is necessary, but when I see

$\rm\ (p-1)!\ mod\ p\:$

written by a high rep user, my heart bleeds. Apart from the personal choice of using upright letters everywhere, typing \mod{p} shouldn't be too difficult.

One of the most common errors, that I also find in students' typescripts, is believing that $...$ is just a way to enable special characters. It is not.

Everything which is math must be typed in as math, even if it is a standalone variable. In MathJax and, a fortiori, in LaTeX.

</rant>

So

We model our decision set, $\mathcal{K}$, as a convex set
in Euclidean space. Furthermore, we define our convex loss
function as $f_{t}\colon \mathcal{K} \rightarrow \mathbb{R}$.
At any finite time $t$, we denote our player's decision
as $x_{t} \in \mathcal{K}$.

Style manuals say the colon should not be used after "as". Also \mapsto is the wrong symbol for functions, it is used to denote a function's action on elements. Also no space should ever precede a comma.

|improve this answer|||||
  • so, how do you propose getting mathematicians/latex users to read and observe basic introductory material? (i agree with your rant and have some good examples, but i won't name names since that's politically unwise.) – barbara beeton Oct 14 '16 at 13:14
  • 1
    @barbarabeeton Rejecting badly written manuscripts could be a start. ;-) – egreg Oct 14 '16 at 14:39
  • Er ... who is this rant aimed at? Neither the OP nor I wrote that. – cfr Oct 14 '16 at 15:32
  • @cfr Did I say that? I meant to say I've seen much worse code than the OP's. – egreg Oct 14 '16 at 15:40

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.