1

There seem to be a clash between two things I usually do but had never done simultaneously: using the T1 font encoding and using \overrightarrow for vectors.

Indeed, I find the \vec arrow's fixed size ugly. For example like this: equation showcasing the little arrows

So what I usually do is \renewcommand{\vec}[1]{\overrightarrow{#1}} which outputs nice long arrows (at least in OT1 encoding).

Although, I have to use the T1 encoding for my current document but it seems to mess with the arrows. For example here, the arrow is too long on the left:

I could provide my whole preamble if the font encoding is not the problem but it's quite long.

So the question is: how to have both a correct encoding (my document is in French) and nice arrows over my vectors?

EDIT: adding an example (after @DavidCarlisle's request)

I found what caused the font change: the newtxmath package. I had used it to be able to use \not with anything I want. After examination, I happen to prefer the original \vec command applied on single characters with the newtxmath font.

Here is the example anyway:

% Set up the document's format to A4 and the font's size to 12pt.
\documentclass[a4paper,12pt]{report}

% Set up the input's encoding to UTF-8, the document's font and language to T1 (adapted to french) and french (the grammar linter uses this parameter).
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}

% Allows to define \notfoo or \nfoo (not recommended) in order for \not\foo to work as wished.
\usepackage{newtxmath}

% Redefines \vec such that the arrow covers the whole name of the vector.
\renewcommand{\vec}[1]{\overrightarrow{#1}}

\begin{document}
\(\vec{v}\)
\end{document}
7
  • Welcome to tex.sx. Commented Dec 20, 2022 at 18:20
  • \vec is intended to be used on just one symbol. In your example, it should be set only on the p, \nu or u, respectively, excluding indices and such.
    – schtandard
    Commented Dec 20, 2022 at 18:30
  • it is hard to comment if you show no code. Unless you are doing something non standard specifying T1 as in \usepackage[T1]{fontenc} has no effect at all on math mode so it is hard to guess what the question is refering to Commented Dec 20, 2022 at 19:54
  • @DavidCarlisle I guess it's probably related to something else then. I'm going to look for the problem Commented Dec 20, 2022 at 21:21
  • @RomainBricout if you provided an example, someone could debug it for you. Commented Dec 20, 2022 at 21:23

1 Answer 1

3

You might use the new pdfmsym “package” (it isn't in the sense of LaTeX).

\documentclass{article}
\usepackage{amsmath}

\input{pdfmsym}% not \usepackage!
\pdfmsymsetscalefactor{8}

\newcommand{\diff}{\mathop{}\!\mathrm{d}}

\begin{document}

\[
\diff\vecc{p_{\mathrm{atome}}}=
\vecc{p_f} - \vecc{p_i}=
m\vecc{v'}-m\shortvecc{v}=
-2mu\vecc{u_x}
\]

\[
\diff\vec{p}_{\mathrm{atome}}=
\vec{p}_f - \vec{p}_i=
m\vec{v}^{\,\prime}-m\vec{v}=
-2mu\vec{u}_x
\]

\end{document}

I'd much prefer the latter format, though.

enter image description here

I see no difference if I add

\usepackage[T1]{fontenc}
\usepackage[french]{babel}

If I use \overrightarrow, I get something like

enter image description here

which, I'm afraid, can hardly be described as “nice”. But I get no difference with or without T1.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .