2

I am trying to write this:

this

Using

$$p_{\Theta | X} = \frac{f_{\Theta}(\theta) p_{X|\Theta}(x\,|\,\theta)}{\int f_{\Theta}(\theta ') p_{X|\Theta}(x\,|\,\theta ') \, d\theta '}$$

However, what I get is this instead:

that

The integral sign does not come out right. Please help.

J. Doe
  • 243
  • 3
    There are some intelligent people behind TeX and LaTeX. The behaviour you see is by design and what people usually want. Same for your other question. – Johannes_B Jan 14 '20 at 04:19
  • 2
    You should also use \mid instead of \,|\,. – Mico Jan 14 '20 at 04:32
  • @Mico, thank you! I have been wondering about the oddity of \,|\,. – J. Doe Jan 14 '20 at 04:41
  • This is identical to your previous question on \sum, again what you show is the standard layout, not wrong, although other layouts could be chosen. – David Carlisle Jan 14 '20 at 07:55

3 Answers3

4

Add a \displaystyle command in front of the \int.

\documentclass{article}
\begin{document}
\[
f_{\Theta | X}(\theta | x) = \frac{f_{\Theta}(\theta) p_{X|\Theta}(x\,|\,\theta)}{\displaystyle\int f_{\Theta}(\theta ') p_{X|\Theta}(x\,|\,\theta ') \, d\theta '}
\]
\end{document}

Also, it's not related at all, but you should use \[...\] for display math mode, not $$...$$.

Vincent
  • 20,157
  • Thank you! That works. I am using Auto-LaTeX on Google Docs. Hence, $$...$$. – J. Doe Jan 14 '20 at 04:22
  • 1
    According to https://sites.google.com/site/autolatexequations/home, you can really use \[ ... \], don't you? "Only converts equations within $$ or \[ symbols, meaning you render only the equations you want to have rendered!" – ivankokan Jan 14 '20 at 04:30
  • 1
    @ivankokan, I didn't know that. Thank you! – J. Doe Jan 14 '20 at 06:19
  • Note that the scope of that \displaystyle affects the entire denominator not just the integral sign. – David Carlisle Jan 14 '20 at 07:56
  • I tried \[P_X\] and it did not work. $$P_X$$ works. Any idea? – J. Doe Jan 14 '20 at 07:58
  • 1
    @J.Doe in a latex document (as posted in examples on this site) if in some non tex system you need $$ for it to recognise the math fragment that may be the case but it's essentially off topic here. – David Carlisle Jan 14 '20 at 09:15
  • @J.Doe There is a drop-down selection in Auto-LaTeX Equations sidebar: Show Advanced Settings -> Select Delimiter Style. Although it seems that delimiters can be used exclusively, if you use both in your document, you can render both, e.g. select $$ ... $$ and click Render Equations, then select \[ ... \] and click Render Equations again. When it comes to Derendering, I found this comment on XXX website a bit confusing: "Same Delimiter Derendering - When you derender new equations now, they will have the same delimiters they were rendered with ($$...$$ or \[...\]) ." – ivankokan Jan 14 '20 at 09:51
  • @J.Doe I suggest you contact Auto-LaTeX and propose improvements. – ivankokan Jan 14 '20 at 09:51
  • @ivankokan, I will try your solution. I never got their Derendering working. – J. Doe Jan 14 '20 at 09:57
  • 1
    It works with \[...\] now. Derendering too. I guess previous attempts had complicated things it didn't like. – J. Doe Jan 14 '20 at 10:06
2

You can try a pkg nccmath, here is a command \medint is useful

\documentclass{article}
\usepackage{nccmath}
\begin{document}
\[
f_{\Theta | X}(\theta | x) = \frac{f_{\Theta}(\theta) p_{X|\Theta}(x\,|\,\theta)}%
{\medint\int f_{\Theta}(\theta ') p_{X|\Theta}(x\,|\,\theta ') \, d\theta '}
\]
\end{document}
poorich
  • 613
1

Just only an addendum for the previous nice answers:

  1. Using empheq to obtain the boxed formula with color;
  2. Using \mid instead of \,|\, (as suggested by user @Mico) that it generates equal left and right blank space;
  3. and...this link to choose your preferite background color called http://latexcolor.com/.

\documentclass[12pt,notitlepage]{book}
    \usepackage{mathtools,amssymb}
    \usepackage{empheq}
    \usepackage[x11names]{xcolor}
    \definecolor{lightgray}{rgb}{0.83, 0.83, 0.83}
    \begin{document}
    \begin{empheq}[box=\fcolorbox{lightgray}{lightgray}]{align}
    f_{\Theta \mid X}&=\frac{f_{\Theta}(\theta) p_{X\mid\Theta}(x\mid\theta)}{\displaystyle \int f_{\Theta}(\theta') p_{X|\Theta}(x\mid\theta') \, d\theta'}
    \end{empheq}
    \end{document}

enter image description here

Sebastiano
  • 54,118