1

How can I remove the decimal 0 from the angle?

\documentclass[11pt,a4paper,dutch]{article}
\usepackage[per-mode=symbol,mode=text,per-mode=symbol,exponent-product=\cdot]{siunitx}
\usepackage[T1]{fontenc}
\usepackage[left=1.2cm,right=3.6cm,top=1.8cm,bottom=2.0cm,marginparwidth=2.4cm]{geometry}
\usepackage{amsmath}
\usepackage{contour}
\usepackage{physics}
\usepackage{xparse}
\usepackage{amssymb}
\usepackage{xcolor}
\usepackage{rotating}
\usepackage{float}
\usepackage{subcaption}
\usepackage{caption}
\usepackage{pgfplots}
\usepackage{tikz}
\tikzset{every picture/.style={line width=0.75pt}}
\usetikzlibrary{arrows.meta,calc,math,quotes,angles}
\usepackage{fancyhdr}
\tikzset{>=latex} % for LaTeX arrow head
\usepackage{xcolor}
\colorlet{veccol}{green!70!black}
\colorlet{vcol}{green!70!black}
\colorlet{xcol}{blue!85!black}
\colorlet{projcol}{xcol!60}
\colorlet{unitcol}{xcol!60!black!85}
\colorlet{myblue}{blue!70!black}
\colorlet{myred}{red!90!black}
\colorlet{mypurple}{blue!50!red!80!black!80}
\tikzstyle{vector}=[->,very thick,xcol]
\sisetup
{
  input-decimal-markers={.},
  output-decimal-marker = {.},
   exponent-to-prefix = true,
   round-mode = figures,
   round-precision = 3,
   scientific-notation = engineering
}

\begin{document} \begin{figure}[h] \centering \begin{minipage} [h]{0.4\textwidth} \centering \begin{tikzpicture} [x=0.75pt,y=0.75pt] \def\R{154.483} \def\ul{0.52} \def\az{15} \coordinate (O) at (0,0); \coordinate (A) at (0,100); \draw[dashed] (A) -- (0,-100); \path (O) node[left=4] {A}; \begin{scope}[xscale=1,yscale=1,rotate around={-\az:(O)}] ; \coordinate (B) at (0,100); \draw[gray, fill=green!30!white] (O)--(0,100)--(-5,100)--(-5,-100)--(0,-100)--cycle; \draw pic[<-,"$\textbf{\small{\ang{\az}}}$",draw=black,angle radius=60,angle eccentricity=1.1]{angle=B--O--A}; \coordinate (R) at (\az:\R); \coordinate (X) at ({\Rcos(\az)},0); \coordinate (Y) at (0,{\Rsin(\az)}); \draw[projcol,dashed] (X) -- (R); \draw[projcol,dashed] (Y) -- (R); \draw[vector,red] (O) -- (R) node[right] {$\SI{835.974}{\newton}$}; \drawvector,<->,projcol node[scale=0.9, below =-1,right] {$\SI{807.48}{\newton}$} -- (O) -- (Y) node[scale=0.9,below=4, left] {$\SI{216.365}{\newton}$}; \end{scope} \end{tikzpicture} \end{minipage} \end{figure} \end{document}

Erik
  • 167

1 Answers1

1

For the use case at hand, I can see no advantage in specifying the siunitx options round-mode = figures and round-precision = 3. It's better to write \SI{835}{\newton} instead of \SI{835.974}{\newton}, etc. Oh, and there's no need to encase the \SI directives in $ math mode shifters. As a side effect of making this change, you won't have to worry about typesetting "15.0" instead of just "15" as the angle of rotation.

Incidentally, \SI is a legacy macro that will eventually go away. Do get used to writing \qty instead of \SI.

enter image description here

Aside: You also may want to think about replacing

  node[scale=0.9, below = 4, left]  {\qty{216}{\newton}\kern0.4em};

with

  node[scale=0.9, above=4, right] {\qty{216}{\newton}};

\documentclass[11pt,a4paper,dutch]{article}
\usepackage[T1]{fontenc}
\usepackage[left=1.2cm, right=3.6cm,
            top=1.8cm, bottom=2.0cm,
            marginparwidth=2.4cm] % are you sure you need this option?
           {geometry}

%% The following packages aren't needed for this example %\usepackage{amsmath} %\usepackage{contour} %\usepackage{physics} %\usepackage{xparse} %\usepackage{amssymb} %\usepackage{xcolor} %\usepackage{rotating} %\usepackage{float} %\usepackage{subcaption} %\usepackage{caption} %\usepackage{fancyhdr}

\usepackage{xcolor} \colorlet{veccol}{green!70!black} \colorlet{vcol}{green!70!black} \colorlet{xcol}{blue!85!black} \colorlet{projcol}{xcol!60} \colorlet{unitcol}{xcol!60!black!85} \colorlet{myblue}{blue!70!black} \colorlet{myred}{red!90!black} \colorlet{mypurple}{blue!50!red!80!black!80}

\usepackage{pgfplots} \usepackage{tikz} \tikzset{every picture/.style={line width=0.75pt}} \usetikzlibrary{arrows.meta,calc,math,quotes,angles} \tikzset{>=latex} % for LaTeX arrow head \tikzstyle{vector}=[->,very thick,xcol]

\usepackage{siunitx} \sisetup{per-mode = symbol, mode = text, exponent-product = \cdot, exponent-to-prefix = true, % the following options are unnecessary or counterproductive: %per-mode = symbol, % redundant %input-decimal-markers = {.}, %output-decimal-marker = {.}, %round-mode = figures, %round-precision = 3, %scientific-notation = engineering }

\begin{document} %\begin{figure}[ht]

\begin{center} %\begin{minipage}[h]{0.4\textwidth} %\centering \begin{tikzpicture}[x=0.75pt,y=0.75pt] \def\R{154.483} \def\ul{0.52} \def\az{15} \coordinate (O) at (0,0); \coordinate (A) at (0,100); \draw[dashed] (A) -- (0,-100); \path (O) node[left=4] {A}; \begin{scope}[xscale=1,yscale=1, rotate around={-\az:(O)}] ; \coordinate (B) at (0,100); \draw[gray, fill=green!30!white] (O)--(0,100)--(-5,100)--(-5,-100)--(0,-100)--cycle; \draw pic[<-,"\small\ang{\az}", draw=black, angle radius=70, % use 70, not 60 angle eccentricity=1.1]{angle=B--O--A}; \coordinate (R) at (\az:\R); \coordinate (X) at ({\Rcos(\az)},0); \coordinate (Y) at (0,{\Rsin(\az)}); \draw[projcol,dashed] (X) -- (R); \draw[projcol,dashed] (Y) -- (R); \draw[vector,red] (O) -- (R) node[right] {\qty{836}{\newton}}; \drawvector,<->,projcol %% Why 'below=-1" in the following line? Why not "below=1"? node[scale=0.9, below =-1, right] {\qty{807}{\newton}} -- (O) -- (Y) node[scale=0.9, below = 4, left] {\qty{216}{\newton}\kern0.4em}; \end{scope} \end{tikzpicture} %\end{minipage} \end{center} %\end{figure} \end{document}

Mico
  • 506,678
  • 1
    thnx. this latex is generated by C# code. So chopping off the decimals has to occur explicitly in either latex or C#. I found this:

    \def\Z{\SI[round-mode = places, round-precision = 0, round-integer-to-decimal]{15}{\degree}} \draw pic[<-,"\textbf{\tiny{\Z}}",draw=black,angle radius=60,angle eccentricity=1.1]{angle=B--O--A};

    thnx for pointing out qty.

    – Erik Feb 19 '23 at 13:44
  • 1
    @Erik - round-mode = places, round-precision = 0 is a nice solution. – Mico Feb 19 '23 at 14:29