以粗体字体排版节点

以粗体字体排版节点

如何${\mathrm{HR}}(\ray{r}, \, P)$用粗体字体排版节点?代码太麻烦了,抱歉。相关节点的命令在最后一行。

\documentclass{amsart}
\usepackage{amsmath}
\usepackage{amsfonts}

\usepackage{tikz}
\usetikzlibrary{calc,angles,positioning,intersections}

%The following commands are taken from a reply by Steven B. Segletes to my post
%"Typesetting arrows above a pair of letters to indicate a line" on
%tex.stackexchange.com.  These commands typeset arrows above letters to indicate
%lines and rays.
  \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{tikzpicture}

\coordinate (O) at (0,0);
\draw[fill] (O) circle (1.5pt);
\coordinate (label_for_O) at ($(O)!-3mm!90:(15:4)$);
\node at (label_for_O){$O$};

%Line $\ell$ is drawn.
\coordinate (left_endpoint_of_ell) at (195:4);
\coordinate (right_endpoint_of_ell) at  (15:4);
\draw[latex-latex] (left_endpoint_of_ell) -- (right_endpoint_of_ell);
\coordinate (label_for_ell) at ($(right_endpoint_of_ell)!-3mm!(left_endpoint_of_ell)$);
\node at (label_for_ell){$\ell$};

%A point P off $\ell$ is plotted.
\coordinate (P) at (170:1.75);
\draw[fill] (P) circle (1.5pt);
\coordinate (P) at ($(170:1.75)!-3mm!(O)$);
\node at (P){$P$};

%Some rays in the closed half 
\draw[-latex, line width=0.8pt] (O) -- (195:2.75);
\coordinate (label_for_ray_r) at ($(195:2.75)!-3mm!-90:(O)$);
\node at (label_for_ray_r){$\ray{r}$};

\draw[-latex] (O) -- (135:2.75);
\coordinate (label_for_ray_a) at ($(135:2.75)!-3mm!(O)$);
\node at (label_for_ray_a){$\ray{a}$};

\draw[-latex] (O) -- (90:2.5);
\coordinate (label_for_ray_b) at ($(90:2.5)!-3mm!(O)$);
\node at (label_for_ray_b){$\ray{b}$};

\draw[-latex] (O) -- (50:3.75);
\coordinate (label_for_ray_c) at ($(50:3.75)!-3mm!(O)$);
\node at (label_for_ray_c){$\ray{c}$};


%Title for ${\mathrm{HR}}(\ray{r}, \, P)$ is typeset.
\coordinate (a_point_on_left_edge) at (left_endpoint_of_ell |- O);
\coordinate (a_horizontal_midpoint) at ($(a_point_on_left_edge)!0.5!(label_for_ell)$);
\coordinate (another_horizontal_midpoint_along_bottom_edge) at (a_horizontal_midpoint |- left_endpoint_of_ell);
\coordinate (title_for_a_set_of_rays) at ($(another_horizontal_midpoint_along_bottom_edge)!-3mm!(a_horizontal_midpoint)$);
\node[font=\bfseries,anchor=north,inner sep=0] at (title_for_a_set_of_rays){${\mathrm{HR}}(\ray{r}, \, P)$};%\unboldmath

\end{tikzpicture}

\end{document}

答案1

我猜你想把东西藏在盒子里:

\node[anchor=north,inner sep=0] at (title_for_a_set_of_rays){%
  \mbox{\boldmath$\mathrm{HR}(\ray{r},P)$}%   
};

在此处输入图片描述

注意。我使用了 的模拟定义\ray,因为您没有提供。\,逗号后面不应该有 。

答案2

\usepackage{bm} % defines commands to access bold math symbols

进而...

\node[anchor=north,inner sep=0] at (title_for_a_set_of_rays)%
    {$\bm{\mathrm{HR}(\ray{r}, P)}$}

font=\bfseries是不需要的。

在此处输入图片描述

相关内容