# How to get a vertical bar which is the exact size of the object?

I wish to use two vertical bars to sandwich a whole object: What I found is that

(Failure 1) if I use usual \mid or \rvert or |, it is too small. (Failure 2) if I use usual \left| or \right|, it is too big (due to that the unequal sizes of the numerator and the denominator). (Failure 3) if I use usual \left| or \right| on the numerator and the denominator separately, even though the size is correct, the the | is not connected. I wish to have | | sandwich from the outside. I wish to have the whole bar connected from the numerator to the denominator. Here is my code:

    \documentclass[aps]{revtex4}
\usepackage{amsmath,amssymb}
\begin{document}
$${\frac{ S }{ \overset{N}{\underset{{a=1}}{ \sum}} T_a } }$$

$$\left| {\frac{ S }{ \overset{N}{\underset{{a=1}}{ \sum}} T_a } } \right|$$

$$\lvert \mid | {\frac{ S }{ \overset{N}{\underset{{a=1}}{ \sum}} T_a } } | \mid \rvert$$

$${\frac{ \left| S \right| }{ \left| \overset{N}{\underset{{a=1}}{ \sum}} T_a \right| } }$$

\end{document}


Is there a better way to fix this problem? Many thanks. Comments are welcome.

You can try with \vline

MWE:

\documentclass[aps]{revtex4}
\usepackage{amsmath,amssymb}
\begin{document}

$\left|\frac{S}{\sum\limits^{N}_{a=1}T_{a}}\right|$

With \verb|\vline|

$\vline\,\frac{S}{\sum\limits^{N}_{a=1}T_{a}}\,\vline$

\end{document}


Output: Some remarks:

1. Use $...$\ instead of $$. See Why is $...$ preferable to$$ ... ?
2. Use \limits instead of \overset and \underset to obtain subscripts and superscrips as in \displaystyle.

Suddenly I realize what you want \documentclass{article}
\begin{document}
\begin{tabular}{|c|}
$\fracS}{\displaystyle\sum_{a=1}^NT_a$
\end{tabular}
\end{document}