Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask question.(5)

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

ITtutoria

ITtutoria Logo ITtutoria Logo

ITtutoria Navigation

  • Python
  • Java
  • Reactjs
  • JavaScript
  • R
  • PySpark
  • MYSQL
  • Pandas
  • QA
  • C++
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Python
  • Science
  • Java
  • JavaScript
  • Reactjs
  • Nodejs
  • Tools
  • QA
Home/ Questions/Why does the illegal unit of measure (pt inserted) error occur?
Next
Inès Levy
  • 12
Inès Levy
Asked: May 18, 20222022-05-18T14:49:38+00:00 2022-05-18T14:49:38+00:00In: Programs

Why does the illegal unit of measure (pt inserted) error occur?

  • 12

. Advertisement .

..3..

. Advertisement .

..4..

I am working on programs, but I found the following warning message:

Illegal unit of measure (pt inserted).

\protect l.1545 & [errormessage]#92;ang{40}$ & 0.52 & 0.44 & 0.27 & 0.10 & -0.01 \ Dimensions can be in units of em, ex, in, pt, pc, cm, mm, dd, cc, nd, nc, bp, or sp; but yours is a new one! I'll assume that you meant to say pt, for printer's points. To recover gracefully from this error, it's best to delete the erroneous units; e.g., type `2' to delete two letters. (See Chapter 27 of The TeXbook.)

! Illegal unit of measure (pt inserted). \protect l.1545 ... & [errormessage]#92;ang{40}$ & 0.52 & 0.44 & 0.27 & 0.10 & -0.01 \ Dimensions can be in units of em, ex, in, pt, pc, cm, mm, dd, cc, nd, nc, bp, or sp; but yours is a new one! I'll assume that you meant to say pt, for printer's points. To recover gracefully from this error, it's best to delete the erroneous units; e.g., type `2' to delete two letters. (See Chapter 27 of The TeXbook.)

Is there any way to stabilize the issue “illegal unit of measure (pt inserted)”?
I read a lot of topics about this, but all of them were trying to install anything. Is this the correct way, or any recommendation for me?
Please find the beginning command below:

\newcommand*{\MinNumber}{0}%
 \newcommand*{\MaxNumber}{1.2}%
 \pgfmathsetmacro{\MidNumber}{(0.8}%
 \def\test#1{\ifdim#1pt>\MidNumber\textcolor{gray!70}{#1}\else{#1}\fi}
 \newcommand{\ApplyGradient}[2]{\centering %
  \pgfmathsetmacro{\PercentColor}{100.0*(#1-\MinNumber)/(\MaxNumber-\MinNumber)}%
  \edef\x{\noexpand\cellcolor{black!\PercentColor}}\x\test{#1}
 }
 \newcolumntype{R}{>{\collectcell\ApplyGradient}p{1.1cm}<{\endcollectcell}}
 \newcolumntype{S}{>{\collectcell\ApplyGradient}p{0.6cm}<{\endcollectcell}}
 %
 \begin{table}[!ht]
 \centering
 \small
 % \renewcommand{\arraystretch}{0.9}
 % \begin{adjustbox}{width=0.8\textwidth}
 \begin{tabular}{>{\centering}p{1.3cm}|>{\centering}p{0.9cm}|R R R R R }
 \multicolumn{2}{c}{testing in[codesample]#92;rightarrow$}& \multicolumn{1}{c} {[codesample]#92;ang{40}$} & \multicolumn{1}{c} {[codesample]#92;ang{20}$} & \multicolumn{1}{c} {[codesample]#92;ang{0}$} & \multicolumn{1}{c} {$-\ang{20}$} & \multicolumn{1}{c} {$-\ang{40}$} \\ \midrule
  & [codesample]#92;ang{40}$ & 0.52 & 0.44 & 0.27 & 0.10 & -0.01 \\
  & [codesample]#92;ang{20}$ & 0.47 & 0.49 & 0.35 & 0.19 & 0.07 \\
 spider9 & [codesample]#92;ang{0}$ & 0.25 & 0.47 & 0.63 & 0.46 & 0.24 \\
  & $-\ang{20}$ & 0.05 & 0.17 & 0.35 & 0.55 & 0.54 \\
  & $-\ang{40}$ & 0.0 & 0.05 & 0.21 & 0.47 & 0.77 \\ 
 \midrule
  & [codesample]#92;ang{40}$ & 0.75 & 0.69 & 0.40 & 0.17 & 0.04 \\
  & [codesample]#92;ang{20}$ & 0.72 & 0.82 & 0.59 & 0.30 & 0.10 \\
 gecko7 & [codesample]#92;ang{0}$ & 0.31 & 0.65 & 1.06 & 0.96 & 0.56 \\
  & $-\ang{20}$ & 0.16 & 0.45 & 0.86 & 1.18 & 0.98 \\
  & $-\ang{40}$ & 0.03 & 0.15 & 0.40 & 0.74 & 0.96 \\ 
 \midrule
  & [codesample]#92;ang{40}$ & 1.09 & 0.75 & 0.39 & 0.14 & 0.02 \\
  & [codesample]#92;ang{20}$ & 0.54 & 0.55 & 0.33 & 0.15 & 0.04 \\
 babyA & [codesample]#92;ang{0}$ & 0.29 & 0.58 & 0.88 & 0.74 & 0.42 \\
  & $-\ang{20}$ & 0.18 & 0.47 & 0.85 & 1.09 & 0.71 \\
  & $-\ang{40}$ & 0.02 & 0.11 & 0.33 & 0.65 & 0.91 \\
 \bottomrule 
 \end{tabular}
 %
 \begin{tabular}{p{0.4cm} S}
 & 0.0 \\
 & 0.1 \\
 & 0.2 \\
 & 0.3 \\
 & 0.4 \\
 & 0.5 \\
 & 0.6 \\
 & 0.7 \\
 & 0.8 \\
 & 0.9 \\
 & 1.0 \\
 & 1.1 \\
 & 1.2 \\
 \end{tabular}
 % \end{adjustbox}
 \caption{Robustness of the top learned controllers for different directions in the real world. 
 The data shows the fitness that the top controllers of three robots in 5 directions (the second column) perform in another directions (the first row). 
 The fitness value in a cell is averaged over three controller and three repetitions for each controller. 
 The dark and light color represent the high and low fitness value respectively.}
 \label{tab:robustness}
 \end{table}

♦ Suggestions of ITtutoria Team

These are some things to consider:

  • \MinNumber is 0 but you can have a -0.01 number.

  • You must ensure that both <dimA> (\ifdim <dimA><relation><dimB>), and <dimB> (<dimB>) are dimensioned if you want to perform a dimensions test. You have

    \ifdim#1pt>\MidNumber

    \MidNumber is not a dimension. It’s just a number (0.8). This is the root cause of the problem.

  • \ApplyGradient should take only one argument and not two.

  • It is awkward to combine booktabs with vertical rules in tabular. They are not necessary; they have been retained in the output.


......... ADVERTISEMENT .........

..8..

illegal%20unit%20of%20measure%20(pt%20inserted)

\documentclass{article}

\usepackage[margin=1in]{geometry}% Just for this example
\usepackage[table]{xcolor}
\usepackage{booktabs,collcell,xfp}

\newcommand*{\ang}[2]{#1^\circ}
\newcommand*{\MinNumber}{-0.01}%
\newcommand*{\MaxNumber}{1.2}%
\newcommand*{\MidNumber}{0.8}%

\newcommand{\test}[2]{\ifdim#1pt>\MidNumber pt\textcolor{gray!70}{#1}\else #1\fi}

\newcommand{\ApplyGradient}[2]{\centering %
 \edef\x{\noexpand\cellcolor{black!\fpeval{100*(#1-\MinNumber)/(\MaxNumber-\MinNumber)}}}\x\test{#1}
}
\newcolumntype{R}{>{\collectcell\ApplyGradient}p{1.1cm}<{\endcollectcell}}
\newcolumntype{S}{>{\collectcell\ApplyGradient}p{0.6cm}<{\endcollectcell}}
%

\begin{document}

\begin{table}
 \centering
 \begin{tabular}{
 >{\centering}p{1.3cm} |
 >{\centering}p{0.9cm} |
 *{5}{R}
 }
 \multicolumn{2}{c}{testing in$\rightarrow$} & 
 \multicolumn{1}{c}{$\ang{40}$} & 
 \multicolumn{1}{c}{$\ang{20}$} & 
 \multicolumn{1}{c}{$\ang{0}$} & 
 \multicolumn{1}{c}{$-\ang{20}$} & 
 \multicolumn{1}{c}{$-\ang{40}$} \\
 \midrule
 & $\ang{40}$ & 0.52 & 0.44 & 0.27 & 0.10 & -0.01 \\
 & $\ang{20}$ & 0.47 & 0.49 & 0.35 & 0.19 & 0.07 \\
 spider9 & $\ang{0}$ & 0.25 & 0.47 & 0.63 & 0.46 & 0.24 \\
 & $-\ang{20}$ & 0.05 & 0.17 & 0.35 & 0.55 & 0.54 \\
 & $-\ang{40}$ & 0.0 & 0.05 & 0.21 & 0.47 & 0.77 \\
 \midrule
 & $\ang{40}$ & 0.75 & 0.69 & 0.40 & 0.17 & 0.04 \\
 & $\ang{20}$ & 0.72 & 0.82 & 0.59 & 0.30 & 0.10 \\
 gecko7 & $\ang{0}$ & 0.31 & 0.65 & 1.06 & 0.96 & 0.56 \\
 & $-\ang{20}$ & 0.16 & 0.45 & 0.86 & 1.18 & 0.98 \\
 & $-\ang{40}$ & 0.03 & 0.15 & 0.40 & 0.74 & 0.96 \\
 \midrule
 & $\ang{40}$ & 1.09 & 0.75 & 0.39 & 0.14 & 0.02 \\
 & $\ang{20}$ & 0.54 & 0.55 & 0.33 & 0.15 & 0.04 \\
 babyA & $\ang{0}$ & 0.29 & 0.58 & 0.88 & 0.74 & 0.42 \\
 & $-\ang{20}$ & 0.18 & 0.47 & 0.85 & 1.09 & 0.71 \\
 & $-\ang{40}$ & 0.02 & 0.11 & 0.33 & 0.65 & 0.91 \\
 \bottomrule 
 \end{tabular}
 \hspace{4mm}
 \begin{tabular}{ S }
 0.0 \\ 0.1 \\ 0.2 \\ 0.3 \\ 0.4 \\ 0.5 \\
 0.6 \\ 0.7 \\ 0.8 \\ 0.9 \\ 1.0 \\ 1.1 \\
 1.2
 \end{tabular}

 \caption{Robustness of the top learned controllers for different directions in the real world. 
 The data shows the fitness that the top controllers of three robots in~5 directions (the second column) perform in another directions (the first row). 
 The fitness value in a cell is averaged over three controller and three repetitions for each controller. 
 The dark and light color represent the high and low fitness value respectively.}
\end{table}

\end{document}
illegal unit of measure
  • 0 0 Answers
  • 99 Views
  • 0 Followers
  • 0
Answer
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

Sidebar

Ask A Question
  • How to Split String by space in C++
  • How To Convert A Pandas DataFrame Column To A List
  • How to Replace Multiple Characters in A String in Python?
  • How To Remove Special Characters From String Python

Explore

  • Home
  • Tutorial

Footer

ITtutoria

ITtutoria

This website is user friendly and will facilitate transferring knowledge. It would be useful for a self-initiated learning process.

@ ITTutoria Co Ltd.

Tutorial

  • Home
  • Python
  • Science
  • Java
  • JavaScript
  • Reactjs
  • Nodejs
  • Tools
  • QA

Legal Stuff

  • About Us
  • Terms of Use
  • Privacy Policy
  • Contact Us

DMCA.com Protection Status

Help

  • Knowledge Base
  • Support

Follow

© 2022 Ittutoria. All Rights Reserved.

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.