Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

This seems to be a dummy one but I haven't found anything that works good for me.

I'm working in an article and I need to get an underlined expression, like this enter image description here

I mean REALLY CLOSE, but, so far, the available options such as \underlying{x} or \underset{_}{x} haven't worked so good because it left a huge vertical space. I need it to be real close of x. Any ideas?

Thanks in advance.

share|improve this question

2 Answers 2

A \underline seems to work great:

enter image description here

If there is still too much space with you can draw your own \rule and tweak the placement as desired:

enter image description here

Code:

\documentclass{article}
\usepackage{amsmath}
\usepackage{calc}

\newcommand{\dd}{\mathrm{d}}
\newcommand{\ux}{\underline{x}}

\newcommand*{\LineWidth}{0.4pt}
\newcommand*{\YShiftContent}{-0.65ex}
\newcommand*{\YShiftRule}{0.5ex}
\newcommand*{\BaselineAdjust}{-0.4ex}
\newcommand{\ru}[1]{\raisebox{\BaselineAdjust}{$\substack{\textstyle #1\\[\YShiftContent]\rule[\YShiftRule]{\widthof{#1}}{\LineWidth}}$}}


\begin{document}   
\[ \int_{R_1} f_x (\ux \mid C_1)\dd \ux \]
or using \verb|\ru| macro:
\[ \int_{R_1} f_x (\ru{x} \mid C_1)\dd \ru{x} \]
\end{document}
share|improve this answer

If you need an underline symbol that's shorter than what's produced by \underline, you could turn to the ushort package and its \ushort macro. The first line below uses the \ushort macro, the second the \underline macro.

enter image description here

\documentclass{article}
\usepackage{ushort,amsmath}
\newcommand{\dee}{\operatorname{d\!}{}} % "differential" operator
% see http://tex.stackexchange.com/a/178948/5001
\setlength\textwidth{2in} % just for this example
\begin{document}   
\[ \int_{R_1} f_x (\ushort{x} \mid C_1)\dee \ushort{x} \]
vs. 
\[ \int_{R_1} f_x (\underline{x} \mid C_1)\dee \underline{x} \]
\end{document}
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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