Text FormattingVertical Space using Overset on a Subscript

Information and discussion about LaTeX's general text formatting features (e.g. bold, italic, enumerations, ...)
Post Reply
clarinetist
Posts: 11
Joined: Sun Nov 18, 2012 8:20 pm

Vertical Space using Overset on a Subscript

Post by clarinetist »

Hi,

This is my first post (plus I'm kinda new to LaTeX) - hope that I've posted this in the right place. Here's the code I've used:

Code: Select all

\documentclass {article}
\usepackage{amsmath, MnSymbol, wasysym, amsthm, colonequals, mathtools, tensor, fixltx2e}
\usepackage{dsfont}
\usepackage[margin=2 cm]{geometry}
\textwidth 16.59cm
\textheight 21.94 cm
\begin{document}
\\ $Z_{x:\overset{1}{\overline{n}|}}$
\end{document}
Here's what it produces:
Capture.PNG
Capture.PNG (1.66 KiB) Viewed 4239 times
I want the part that starts with the x to be treated as a regular subscript, i.e. the problem is that there's too much vertical space. I've done a lot of searching and haven't found a solution to this problem.

Thanks for any help!

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

And: Currently, Packt sells ebooks for $4.99 each if you buy 5 of their over 1000 ebooks. If you choose only a single one, $9.99. How about combining 3 LaTeX books with Python, gnuplot, mathplotlib, Matlab, ChatGPT or other AI books? Epub and PDF. Bundle (3 books, add more for higher discount): https://packt.link/MDH5p

cgnieder
Site Moderator
Posts: 2000
Joined: Sat Apr 16, 2011 7:27 pm

Vertical Space using Overset on a Subscript

Post by cgnieder »

Hi clarinetist,

Welcome to the LaTeX community!

How should it look like? It seems as if you're faking a fraction, but that's probably not it?

BTW: your MWE can still be shortened:

Code: Select all

\documentclass{article}
\usepackage{amsmath}
\begin{document}
 $Z_{x:\overset{1}{\overline{n}|}}$
\end{document}
I take it the \\ in the MWE is a leftover? Anyway, I suspect you're using it wrongly. It should rarely be necessary to use \\ anywhere else than in tables and arrays... Regards
site moderator & package author
clarinetist
Posts: 11
Joined: Sun Nov 18, 2012 8:20 pm

Vertical Space using Overset on a Subscript

Post by clarinetist »

Hi cgnieder,

Thanks for the blurb about the \\. This is what I want (minus the bar on top of the Z:
Capture.PNG
Capture.PNG (737 Bytes) Viewed 4216 times
User avatar
cgnieder
Site Moderator
Posts: 2000
Joined: Sat Apr 16, 2011 7:27 pm

Vertical Space using Overset on a Subscript

Post by cgnieder »

clarinetist wrote:Hi cgnieder,

Thanks for the blurb about the \\.
You wouldn't believe how many people use it the wrong way...

There should be better ways of doing this and it still needs tweaking but it might be a start:

Code: Select all

\documentclass{article}
\usepackage{tikz}

\makeatletter
\newcommand*\findabettername@aux[2]{%
  \begin{tikzpicture}[remember picture,inner sep=0pt,baseline=(x.base)]
   \node (x) {\(#1#2\)} ;
   \node[overlay,above,yshift=2pt] at (x) {\(#11\)} ;
   \draw[semithick] (x.north west) -- (x.north east) -- (x.south east) ;
  \end{tikzpicture}
}
\newcommand\findabettername{\mathpalette\findabettername@aux}
\makeatother

\begin{document}

\[ Z_{x:\findabettername{n}} \]

\end{document}
Regards
site moderator & package author
Post Reply