# How to write this equation in LaTeX

I want the code LaTeX of the following equation. Can anyone help me?

As shown in my code below, the term (n/r)is not small, How I can do it as in the source picture?

source pic:

Code:

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
$$\begin{split} \int_{0}^{1} (f_{n}-{\tiny \frac{n}{r}} f_{n})^{2} r~dr~+2n\int_{0}^{1}f_{n}f_{n}dr\\ = \int_{0}^{1}(f_{n}-{\tiny \frac{n}{c}} f_{n})^{2} r~dr + nf^{n}_{2}(1) \end{split}$$
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%


My output:

• Welcome to TX.SE. There are a lot of resources online that can tell you how to do it. Maybe you can start with en.m.wikibooks.org/wiki/LaTeX/Mathematics – nidhin Nov 6 '18 at 11:32
• I know, but my problem only how to write (n/r) term in a small size!! I tried using \tiny but not working! Can you help me? – Mohsen Ali Nov 6 '18 at 11:35
• Welcome to TeX.SX! Please help us help you and add a minimal working example (MWE) that illustrates your problem. Reproducing the problem and finding out what the issue is will be much easier when we see compilable code, starting with \documentclass{...} and ending with \end{document}. – albert Nov 6 '18 at 11:41
• Try \tfrac (in my opinion, it's too small). – Bernard Nov 6 '18 at 11:42
• Can we showcase this question in some sort of go-to page for "How not to ask a question on tex.se - the perfect example and what specifically is so bad about it"? :D – thymaro Nov 6 '18 at 11:45

Add \textstyle at the beginning of each line. Get rid of \tiny (it is a text directive, not a math style).

By default, $...$ puts the math in \textstyle. However, $...$ as well as $$...$$, and others set the math in the larger \displaystyle, by default.

\documentclass{article}
\usepackage{amsmath}
\begin{document}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
$$\begin{split}\textstyle \int_{0}^{1} (f_{n}-{\frac{n}{r}} f_{n})^{2} r~dr~+2n\int_{0}^{1}f_{n}f_{n}dr\\\textstyle = \int_{0}^{1}(f_{n}-{\frac{n}{c}} f_{n})^{2} r~dr + nf^{n}_{2}(1) \end{split}$$
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\end{document}


• @MohsenAli You are welcome. And welcome to the site. Remember, for future reference, that it is important to provide a small minimum working example of code with your questions (beginning with \documentclass). – Steven B. Segletes Nov 6 '18 at 12:06

You can have one of these:

\documentclass{article}
\usepackage{mathtools, nccmath}

\begin{document}

$$\begin{split}\textstyle \prescript{}{0}{\int^{1}}(f_{n} - \frac{n}{r} f_{n})^{2} r\,dr + 2n \prescript{}{0}{\int^{1}}f_{n}f_{n}\,dr\\ \textstyle = \prescript{}{0}{\int^{1}}(f_{n}- \frac{n}{c} f_{n})^{2} r\,dr + nf^{n}_{2}(1) \end{split}$$

$$\begin{split} \prescript{}{0}{\int^{1}}\!\bigl(f_{n} - \tfrac{n}{r} f_{n}\bigr)^{2} r\,dr + 2n \prescript{}{0}{\int^{1}}\!f_{n}f_{n}\,dr\\ = \prescript{}{0}{\int^{1}}\!\bigl(f_{n}- \tfrac{n}{c} f_{n}\bigr)^{2} r\,dr + nf^{n}_{2}(1) \end{split}$$

$$\begin{split} \prescript{}{0}{\int^{1}}\! \Bigl(f_{n} - \mfrac{n}{r} f_{n}\Bigr)^{\!2} r\,dr + 2n \prescript{}{0}{\int^{1}}\!f_{n}f_{n}\,dr\\ = \prescript{}{0}{\int^{1}}\!\Bigl(f_{n} - \mfrac{n}{c} f_{n}\Bigr)^{\!2} r\,dr + nf^{n}_{2}(1) \end{split}$$
\end{document}