Text FormattingHow do I get these two operators to be in the same hight?

Information and discussion about LaTeX's general text formatting features (e.g. bold, italic, enumerations, ...)
Post Reply
Yue
Posts: 30
Joined: Sat May 08, 2010 9:58 pm

How do I get these two operators to be in the same hight?

Post by Yue »

Hello ppl It is my first time posting here.
I have trouble getting these two operators in the same height:
$\c_{\textbf{k}}^\dagger$ and $\c_{\textbf{k}'}^\dagger$. The k's should be at the same level, but the ' is somehow making the k' lower.
Anyone who can 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

gmedina
Posts: 2313
Joined: Wed Jul 11, 2007 11:45 pm

Re: How do I get these two operators to be in the same hight

Post by gmedina »

Please post complete compilable code.
1,1,2,3,5,8,13,21,34,55,89,144,233,...
Yue
Posts: 30
Joined: Sat May 08, 2010 9:58 pm

How do I get these two operators to be in the same hight?

Post by Yue »

gmedina wrote:Please post complete compilable code.
here it is:

\listfiles
\documentclass[a4paper, twoside, 12pt]{memoir}
\usepackage{amssymb}
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{amsthm}
\usepackage[latin1]{inputenc}
\usepackage[T1]{fontenc}
\usepackage[danish]{babel}
\usepackage{bbm}
\usepackage[mathscr]{euscript}
\usepackage{ifthen}


\begin{document}
\section{Hi}
$c_{\textbf{k}}^\dagger c_{\textbf{k}'}^\dagger=0$

\end{document}
User avatar
gmedina
Posts: 2313
Joined: Wed Jul 11, 2007 11:45 pm

How do I get these two operators to be in the same hight?

Post by gmedina »

You can use a \phantom command to create an "invisible" prime for the first k:

Code: Select all

\documentclass[a4paper, twoside, 12pt]{memoir}
\usepackage{amssymb}
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{amsthm}
\usepackage[latin1]{inputenc}
\usepackage[T1]{fontenc}
\usepackage[danish]{babel}
\usepackage{bbm}
\usepackage[mathscr]{euscript}
\usepackage{ifthen}


\begin{document}
\section{Hi}
$c_{\textbf{k}\phantom{\sp{\prime}}}^\dagger c_{\textbf{k}'}^\dagger=0$

\end{document}
1,1,2,3,5,8,13,21,34,55,89,144,233,...
Yue
Posts: 30
Joined: Sat May 08, 2010 9:58 pm

Re: How do I get these two operators to be in the same hight

Post by Yue »

Man thank you so much! And so fast replies. Are you employed here or are you just very friendly and helpful?:)

Btw, what does \sp do?
User avatar
svend_tveskaeg
Posts: 478
Joined: Sun Jul 12, 2009 5:31 am

How do I get these two operators to be in the same hight?

Post by svend_tveskaeg »

See (for example) the last item before subsection 6.5 in LaTeX2man manual, concerning the \sp command.

Google is your friend!
``In the game of chess, you can never let your adversary see your pieces.''
-- Zapp Brannigan, Futurama (season 1, episode 4)
User avatar
gmedina
Posts: 2313
Joined: Wed Jul 11, 2007 11:45 pm

How do I get these two operators to be in the same hight?

Post by gmedina »

svend_tveskaeg wrote:See (for example) the last item before subsection 6.5 in LaTeX2man manual, concerning the \sp command.

Google is your friend!
Well, that document explains some \SP command which evidently is not the same as the \sp command that I used (LaTeX is case-sensitive), so yes... Google is your friend if you use it well.

Answering Yue's question, \sp is the command that produces superscripts; in fact the sign "^" is nothing but an alias for \sp. Analogously, "_" is just an alias for \sb:

Code: Select all

\documentclass{article}

\begin{document}

$a^{2}_{i}$ $a\sp{2}\sb{i}$

\end{document}
1,1,2,3,5,8,13,21,34,55,89,144,233,...
Yue
Posts: 30
Joined: Sat May 08, 2010 9:58 pm

Re: How do I get these two operators to be in the same hight

Post by Yue »

Thx alot
Post Reply