0

I am adopting code for drawing arrows above letters indicating rays from Steven B. Segletes; he had replied to a post "Typesetting arrows above a pair of letters to indicate a line" on tex.stackexchange.com. When I changed the font to \footnotesize, the arrow seems to have a dash typed in front of the arrowhead. How do I get the arrow drawn correctly - and longer? Currently, the arrowheads of the arrows are drawn directly over the letters "r," "s," and "t."

Is it customary to have the prime typeset under the arrow or beside it when the ray is indicated by a single letter?

\documentclass{article}

\usepackage{amsmath, mathtools, amssymb, amsthm}

\usepackage[dvipsnames]{xcolor} \usepackage{tikz} \usetikzlibrary{calc}

\usepackage{scalerel} \def\shrinkage{-2.4mu} \def\vecsign#1{\rule[1.388\LMex]{\dimexpr#1-2.5pt}{.36\LMpt}% \kern-6.0\LMpt\mathchar"017E} \def\dvecsign#1{\smash{\stackon[-1.989\LMpt]{\SavedStyle\mkern-\shrinkage\vecsign{#1}}% {\rotatebox{180}{$\SavedStyle\mkern-\shrinkage\vecsign{#1}$}}}} \def\dvec#1{\ThisStyle{\setbox0=\hbox{$\SavedStyle#1$}% \def\useanchorwidth{T}\stackon[-4.2\LMpt]{\SavedStyle#1}{,\dvecsign{\wd0}}}} \def\theraysign#1{\rule[1.384\LMex]{\dimexpr#1-2.5pt}{.40\LMpt}% \kern-6.0\LMpt\mathchar"017E} \def\raysign#1{\smash{\SavedStyle\mkern-\shrinkage\theraysign{#1}}} \def\ray#1{\ThisStyle{\setbox0=\hbox{$\SavedStyle#1$}% \def\useanchorwidth{T}\stackon[-4.2\LMpt]{\SavedStyle#1}{,\raysign{\wd0}}}} \usepackage{stackengine,amsmath} \stackMath \usepackage{graphicx}

\begin{document}

\begin{center} \begin{tikzpicture}

%An angle and its angle bisector are drawn.

\path (0,0) coordinate (A'); \path ($(A') +({(3/11)(10)},0)$) coordinate (O') ($(O') +({(3/11)9(3/5)},{(3/11)9(4/5)})$) coordinate (B'); \node[anchor={180-1/2(acos(-3/5))}, inner sep=0, font=\footnotesize] at ($(O') +({(180-1/2*(acos(-3/5)))+180}:0.1)$){$O{\makebox[0pt][l]{\smash{${}^{\prime}$}}}$}; \draw[-latex] (O') -- ($(A')!-0.75cm!(O')$); \path node[anchor=east, inner sep=0, font=\footnotesize] at ($(A')!-0.85cm!(O')$){$\ray{r{\makebox[0pt][l]{\smash{${}^{\prime}$}}}}$}; \draw[-latex] (O') -- ($(B')!-0.75cm!(O')$); \path node[anchor={(180-acos(-3/5))+180}, inner sep=0, font=\footnotesize] at ($(B')!-0.75cm!(O')$){$\ray{s{\makebox[0pt][l]{\smash{${}^{\prime}$}}}}$};

\coordinate (C') at ($(O') +({(3/11)(-36/19)},{(3/11)72/19})$); \draw[-latex, dashed] (O') -- ($(C')!-1cm!(O')$); \path node[anchor={(180-1/2*(acos(-3/5)))+180}, inner sep=0, font=\footnotesize] at ($($(C')!-1cm!(O')$)!-0.05cm!(O')$){$\ray{t{\makebox[0pt][l]{\smash{${}^{\prime}$}}}}$};

\end{tikzpicture} \end{center}

\end{document}

user74973
  • 4,071
  • 1
    I have the feeling that this question is not tagged correctly as the problem with the arrows should also occur if used outside of the TikZ context and therefore is independent of TikZ. You should probably reduce your MWE to contain only the essential parts to make it easier to grasp what you are actually asking. But why don't you just use $\vec{s}'$ or maybe $\vec{s}\kern2mu'$ to have a better spacing? The idea of the answer you cite was to place an arrow over two letters, but you only need to place it over single letters it seems. – Jasper Habicht Dec 08 '23 at 18:48
  • @Jasper Habicht As my sample was only that of a TikZ diagram, I tagged it as that. As the typesetting only occurs within the nodes of the TikZ diagram, it would be appropriate to tag tex.core. – user74973 Dec 11 '23 at 00:12
  • I agree with Jasper. Just because you use code within TikZ, that doesn't mean TikZ is needed for your question (the code in the answer you cite isn't in TikZ, for example). Double check the [tag:tex-core] page: being within TikZ would be the opposite of tex.core, as would using any packages. And again: why not $\vec{s}'$? – Teepeemm Dec 11 '23 at 01:50

1 Answers1

3

The code you've borrowed is for an arrow that can be as long as necessary. Since you only need one letter, I don't quite see why you want that code. The following is four different ways of typesetting the four labels you have in your code. (I've taken the labels out of the TikZ picture, since that was unrelated to what you're trying to do.)

  1. Your approach, where the arrows are too close to their letters in footnote size.
  2. The TeX defined \vec, where the prime is too close to the vector.
  3. \vec, but then using Jasper's suggested \mkern2mu.
  4. Using \,, which TeX defines to be \mkern3mu.

Options 3 and 4 look good to me. Note that the preamble is only present for option 1; options 2, 3, and 4 require no preamble at all.

\documentclass{article}

% this entire preample is only necessary for defining \ray \usepackage{scalerel} \def\shrinkage{-2.4mu} \def\vecsign#1{\rule[1.388\LMex]{\dimexpr#1-2.5pt}{.36\LMpt}% \kern-6.0\LMpt\mathchar"017E} \def\dvecsign#1{\smash{\stackon[-1.989\LMpt]{\SavedStyle\mkern-\shrinkage\vecsign{#1}}% {\rotatebox{180}{$\SavedStyle\mkern-\shrinkage\vecsign{#1}$}}}} \def\dvec#1{\ThisStyle{\setbox0=\hbox{$\SavedStyle#1$}% \def\useanchorwidth{T}\stackon[-4.2\LMpt]{\SavedStyle#1}{,\dvecsign{\wd0}}}} \def\theraysign#1{\rule[1.384\LMex]{\dimexpr#1-2.5pt}{.40\LMpt}% \kern-6.0\LMpt\mathchar"017E} \def\raysign#1{\smash{\SavedStyle\mkern-\shrinkage\theraysign{#1}}} \def\ray#1{\ThisStyle{\setbox0=\hbox{$\SavedStyle#1$}% \def\useanchorwidth{T}\stackon[-4.2\LMpt]{\SavedStyle#1}{,\raysign{\wd0}}}} \usepackage{stackengine} \stackMath

\begin{document}

\renewcommand{\arraystretch}{1.3} \begin{tabular}{lll}\hline & Normal size & Footnote size\\hline your approach & $O{\makebox[0pt][l]{\smash{${}^{\prime}$}}}$, $\ray{r{\makebox[0pt][l]{\smash{${}^{\prime}$}}}}$, $\ray{s{\makebox[0pt][l]{\smash{${}^{\prime}$}}}}$, $\ray{t{\makebox[0pt][l]{\smash{${}^{\prime}$}}}}$ & {\footnotesize $O{\makebox[0pt][l]{\smash{${}^{\prime}$}}}$, $\ray{r{\makebox[0pt][l]{\smash{${}^{\prime}$}}}}$, $\ray{s{\makebox[0pt][l]{\smash{${}^{\prime}$}}}}$, $\ray{t{\makebox[0pt][l]{\smash{${}^{\prime}$}}}}$} \ naive approach & $O'$, $\vec r'$, $\vec s'$, $\vec t'$ & {\footnotesize $O'$, $\vec r'$, $\vec s'$, $\vec t'$} \ Jasper's suggested kern & $O'$, $\vec r\mkern2mu'$, $\vec s\mkern2mu'$, $\vec t\mkern2mu'$ & {\footnotesize $O'$, $\vec r\mkern2mu'$, $\vec s\mkern2mu'$, $\vec t\mkern2mu'$} \ thinmuskip & $O'$, $\vec r,'$, $\vec s,'$, $\vec t,'$ & {\footnotesize $O'$, $\vec r,'$, $\vec s,'$, $\vec t,'$} \\hline \end{tabular}

\end{document}

code output

Teepeemm
  • 6,708
  • As Steven B. Segletes stated in the post https://tex.stackexchange.com/questions/114321/extensible-vec-instead-of-overrightarrow, "\vec does not always put the arrow where I want it." I also do not like how short the arrow is using \vec. – user74973 Dec 13 '23 at 00:12
  • Using \normalsize font, I like the height and length of the arrow with the code that I provided. I don't like the height of the arrow when I use \footnotesize font. – user74973 Dec 13 '23 at 00:15
  • What would you suggest to increase the height of the arrows so that I can use \footnotesize font? – user74973 Dec 13 '23 at 00:16
  • @user74973 I assume by height you mean the vertical placement of the arrow. Probably something like $\vec{\vphantom{t}r}$. A more manual placement would involve \raisebox. – Teepeemm Dec 13 '23 at 15:18