Math & ScienceSpace problem with square root

Information and discussion about LaTeX's math and science related features (e.g. formulas, graphs).
Post Reply
User avatar
Cham
Posts: 937
Joined: Sat Apr 02, 2011 4:06 pm

Space problem with square root

Post by Cham »

I'm having a spacement problem with the following square root.

I need the left square root to be exactly of the same size as the one on the right. Currently, if you look carefully, the left horizontal bar is slightly lower than the one on the right (because of the "d" symbol, I guess), and the lower-left "spike" is lower than the one on the right (probably because of the "0").

Code: Select all

\documentclass[12pt,letterpaper]{article}
\usepackage[T1]{fontenc}
\usepackage{lmodern}
\usepackage{amsmath}
\usepackage{tensor}

\begin{document}
	\begin{equation}
		\label{vitesse des ondes sonores}
		\tensor{v}{_{s}} = \sqrt{\frac{\gamma \, \tensor{p}{_0}}{\tensor{\rho}{_0}}} \equiv \sqrt{\frac{d p}{d \rho}}.
	\end{equation}
\end{document}
Here's a preview :
square-roots.jpg
square-roots.jpg (9.03 KiB) Viewed 7407 times
How can I make both square-roots of the same shape and size (same as the one on the right) ?
I tried to use the \smash command, but no luck yet.

Recommended reading 2024:

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

Learn LaTeX easily with newest books:

The LaTeX Beginner's Guide: 2nd edition and perfect for students writing a thesis

The LaTeX Cookbook: 2nd edition full of practical examples for mathematics, physics, chemistry, and more

LaTeX Graphics with TikZ: the first book about TikZ for perfect drawings in your LaTeX thesis

User avatar
Cham
Posts: 937
Joined: Sat Apr 02, 2011 4:06 pm

Space problem with square root

Post by Cham »

Hmm, I think I got it. Adding \vphantom{d} in the first fraction seems to solve my problem.
User avatar
Stefan Kottwitz
Site Admin
Posts: 10359
Joined: Mon Mar 10, 2008 9:44 pm

Space problem with square root

Post by Stefan Kottwitz »

Good, often a workaround using \vphantom or \rule (with 0pt line thickness but certain height) helps.

Stefan
LaTeX.org admin
User avatar
localghost
Site Moderator
Posts: 9202
Joined: Fri Feb 02, 2007 12:06 pm

Space problem with square root

Post by localghost »

You could also try \mathstrut where needed.

Code: Select all

\documentclass[11pt]{article}
\usepackage[T1]{fontenc}
\usepackage{lmodern}
\usepackage{amsmath}
\usepackage{tensor}

\begin{document}
  \begin{equation}
    \label{vitesse des ondes sonores}
    \tensor{v}{_{s}} = \sqrt{\frac{\gamma \, \tensor{p}{_0}\mathstrut}{\tensor{\rho}{_0}}} \equiv \sqrt{\frac{d p}{d \rho}}.
  \end{equation}
\end{document}

Thorsten
Attachments
The obtained output.
The obtained output.
square-strut.png (9.36 KiB) Viewed 7404 times
Post Reply