我有一段文字如下:
They use a metric similar to my cost metric which is more lenient than
traditional population evaluation metrics, which is
$$sim(x,g) = max\paren{1−\frac{\abs{x-g}}{\abs{g}},0}$$
但是这并没有编译成功。到底出了什么问题?
相关包和重新定义:
\usepackage{mathtools}
\usepackage{amsmath}% This is for maths. Note, fleqn makes it left aligned. [fleqn]
\usepackage{amssymb}
\DeclarePairedDelimiter{\paren}{(}{)}
% note: \lvert and \rvert look like | and |, but are spaced as
% delimiters,so they'll look a little nicer
\DeclarePairedDelimiter{\abs}{\lvert}{\rvert}
\DeclareMathOperator*{\argmin}{arg\,min}
该方程应如下所示:https://cl.ly/0l0g3B1r3E44
答案1
对我来说,它编译得很好,但您在数学公式中使用了一些类似于减号的符号,而不是减号本身,导致减号被删除。此外,不要使用$$ ... $$
,ams 包由 加载mathtools
,在数学中使用直立(罗马)表示“单词”,并调整括号大小。
\documentclass{article}
\usepackage{mathtools}
%\usepackage{amsmath}% This is for maths. Note, fleqn makes it left aligned. [fleqn]
%\usepackage{amssymb}
\DeclarePairedDelimiter{\paren}{(}{)}
% note: \lvert and \rvert look like | and |, but are spaced as
% delimiters,so they'll look a little nicer
\DeclarePairedDelimiter{\abs}{\lvert}{\rvert}
%\DeclareMathOperator*{\argmin}{arg\,min}
\DeclareMathOperator{\simo}{sim}
\begin{document}
They use a metric similar to my cost metric which is more lenient than traditional population evaluation metrics, which is
\begin{equation}
\simo(x,g) = \max\paren[\bigg]{1-\frac{\abs{x-g}}{\abs{g}},0}
\end{equation}
\end{document}