1

I've just installed TeXstudio and I have two troubles with my first attempt:

This is the code:

Since the size of subgroups divides the size of group, |H| \le \frac{|G|}{2} .\\ Hence \mathbf{P}(h \in H)\le \frac{1}{2} \: so  \mathbf{P}(h \notin H) \ge \frac{1}{2}.

And this is how it has been shown:

enter image description here

and I want to fix these two mistakes:

1) |H| converted to -H-, surprisingly!

2) Hence and so are Italic! In fact they has been considered as a part of formula but I do not want so!

Can anyone help me to fix them?

Edit (Due to CarLaTeX's kind answer)

I have copied your code and here is the result:

enter image description here

  • Welcome to TeX.SE! Can you post a full compilable code? Commands like \frac and \le are meant to be used in math environment. Judging from the output, it doesn't seem like you enclosed the whole thing in \( \) as well, so what is your code exactly? – Troy Mar 31 '17 at 7:18
  • @Troy -- i think the "Hence" is treated as math because the \le would have gotten an error message (since it requires math mode) and tex would have inserted a $ sign. – barbara beeton Mar 31 '17 at 12:19
5

As Troy said, formulae should be within \(...\), if inline math, or within \[...\], if display math.

The following works perfectly in TeXstudio.

\documentclass{article} 
\usepackage{amsmath} 
\begin{document} 
Since the size of subgroups divides the size of group, \(|H| \le \frac{|G|}{2}\).

Hence \(\mathbf{P}(h \in H)\le \frac{1}{2} \:\) so  \(\mathbf{P}(h \notin H) \ge \frac{1}{2}\).
\end{document}

enter image description here

Edit: answer to the OP's comment.

"Hence" is not pushed forward, as you can see from the enlarged image, where I added a red line to show the alignment.

It may look so due to the H shape, but it is not.

enter image description here

  • 1
    @LeilaHatami "Hence" is already correctly aligned, see the edit of my answer. – CarLaTeX Mar 31 '17 at 12:03
  • 1
    @LeilaHatami -- did you by chance insert a blank line before the line starting with "Hence"? (that sometimes happens when cutting and pasting.) – barbara beeton Mar 31 '17 at 12:21
  • 1
    It's probably due to a paragraph indent? – Troy Mar 31 '17 at 12:23
  • 1
    @LeilaHatami Your paragraph is indented, if Barbara's comment doesn't solve your problem, please add a COMPLETE minimal working example (MWE), otherwise it's impossible to help you! – CarLaTeX Mar 31 '17 at 12:25
  • 1
    @LeilaHatami -- well, \\ will break the line and extend the broken line to the right margin. \newline will break the line and leave it at its "natural" length. and a blank line will start a new paragraph, but you can reverse the indentation with \noindent. there may be some other more esoteric methods, but nothing an inexperienced user wants to use. (the primitive \break acts like \\ except that it doesn't look for a [ to adjust the vertical spacing; someone working in latex almost never wants to use \break.) – barbara beeton Mar 31 '17 at 12:32

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.