Math & ScienceAlignment of Vector Arrow

Information and discussion about LaTeX's math and science related features (e.g. formulas, graphs).
Post Reply
Sahas
Posts: 8
Joined: Wed Aug 31, 2011 10:59 am

Alignment of Vector Arrow

Post by Sahas »

Hello!

I am newbie in LaTeX and use Lyx.
A prepare a book and use KOMA-Script as document class. The font is default (as I guess, it is Latin Modern Roman).
In the math mode all letters are italic - it is no problem.
But, the symbol "vector arrow" over the letter (\vec command) is also italic, and it looks bad because sometimes, when I write for example $\psi(\vec r)$, the arrow overlaps right bracket. When I switch the font to Times Roman the arrow is on the good place but I do not like this font.
I am looking for problem decision and have found only this topic http://www.latex-community.org/forum/vi ... =46&t=4389, there the next command is proposed: $\vec{\mskip\thinmuskip 1}$, but it is bad because of extra space before letter.

Please, give me some advices how to fix a problem.
Last edited by Sahas on Mon Sep 05, 2011 8:07 pm, edited 1 time in total.

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

localghost
Site Moderator
Posts: 9202
Joined: Fri Feb 02, 2007 12:06 pm

Alignment of Vector Arrow

Post by localghost »

In LaTeX I would include the esvect package. It provides some nicer looking vector arrows and in comparison to vanilla LaTeX places the arrow a little bit better.

Code: Select all

\documentclass[11pt]{article}
\usepackage[T1]{fontenc}
\usepackage[b]{esvect}

\begin{document}
  \[
    \Psi(\vv{r})
  \]
\end{document}
For details refer to the package manual.

Disclaimer:
Since I'm not a LyX user, the above suggestions only represent an idea. I can't neither help with LyX in general nor with including packages into LyX nor with doing additional settings.


Best regards and welcome to the board
Thorsten
Sahas
Posts: 8
Joined: Wed Aug 31, 2011 10:59 am

Re: Alignment of Vector Arrow

Post by Sahas »

Thank you for answer!
I have tried esvect package and vectors from it look really better than standard. But unfortunately the arrow is too long, it looks like \overrightarrow command (may be I am too fastidious? :-).
And I did not find in manual how to change arrow length.
I will try to see into the code, may be I can change it for my needs =)
Sahas
Posts: 8
Joined: Wed Aug 31, 2011 10:59 am

Re: Alignment of Vector Arrow

Post by Sahas »

So, I have found file esvect.sty and change the command \newcommand{\vecteur}:
the line $\m@th\mkern2mu\relax#4#1\mkern-1.5mu is replaced by this one:
$\m@th\mkern3mu\relax#4#1\mkern-5.5mu

I do not know what it means but now arrow looks almost as I wanted :-)
User avatar
shadgrind
Posts: 140
Joined: Thu Jul 16, 2009 12:39 am

Alignment of Vector Arrow

Post by shadgrind »

Another possibility is to use the fouriernc package, which makes $\psi(\vec r)$ look like this:
vectest.png
vectest.png (2.7 KiB) Viewed 9505 times
Notice that the vector arrow is short (unlike for esvect), is not italicized (unlike for the default Computer Modern), and does not touch the parentheses (unlike for the Times-ish txfonts). I just think that the Fourier fonts are much better designed than most math fonts for LaTeX, which is why I switched to using fouriernc.
System: TeX Live 2012, Fedora 18 x86_64, GNU Emacs 24.2
Sahas
Posts: 8
Joined: Wed Aug 31, 2011 10:59 am

Re: Alignment of Vector Arrow

Post by Sahas »

Thank you for reply!
Arrows from Fourier Font really look excellent (although some letters, for example \psi, are more sophisticated in Latin Modern than in Fourier, for me :-)
Post Reply