I have a long equation which I am trying to fit into a single line:
\documentclass[a4paper,11pt,oneside]{article}
%%% DOCUMENT SETUP %%%
\PassOptionsToPackage{medium}{titlesec}
% packages and configurations come here (see list below).
\graphicspath{{images/}}
\title{My title}
\author{Myself}
\date{\today{}}
\begin{document}
\maketitle
\newcommand{\indicator}[1]{\mathbbm{1}_{\{#1\}}}
\newcommand{\sgn}{\mathrm{sgn}}
\begin{align}
\Lambda=
\frac{1}{x}\left(
\indicator{z\geq0}
-e^{-xt}\Phi\left(\beta_0\right)
+\frac{e^{-zy}}{2}\left(
e^{-zp}\left(\frac{y}{p}-1\right)\Phi\left(\sgn(z)\beta_1\right)
-e^{zp}\left(\frac{y}{p}+1\right)\Phi\left(-\sgn(z)\beta_2\right)
\right)
\right)
\end{align}
\end{document}
Based on this answer, I have tried to compact the equation by modifying the values of \thinmuskip
and \medmuskip
:
\begingroup
\setlength{\thinmuskip}{0mu}
\setlength{\medmuskip}{0mu}
\begin{align}
\Lambda=
\frac{1}{x}\left(
\indicator{z\geq0}
-e^{-xt}\Phi\left(\beta_0\right)
+\frac{e^{-zy}}{2}\left(
e^{-zp}\left(\frac{y}{p}-1\right)\Phi\left(\sgn(z)\beta_1\right)
-e^{zp}\left(\frac{y}{p}+1\right)\Phi\left(-\sgn(z)\beta_2\right)
\right)
\right)
\end{align}
\endgroup
However I am getting the following errors:
! Incompatible glue units. \setlength{\thinmuskip}{0mu}
! Illegal unit of measure (pt inserted). \setlength{\medmuskip}{0mu}
Moreover, the string u!
appears in my output at the place where the group begins.
There are other questions on this site about this sort of error, such as this, but it seems unrelated to the problem at hand.
What is causing my code to fail here?
Edit: packages/settings for my document
\usepackage{lmodern}
\usepackage[T1]{fontenc}
\usepackage{bbm}
\usepackage{bm}
\usepackage[top=1in, bottom=1in, left=1in, right=1in]{geometry}
\usepackage{graphicx}
\usepackage[colorlinks=true,allcolors=blue]{hyperref}
\usepackage[authoryear]{natbib}
\usepackage{titlesec}
\usepackage[dvipsnames]{xcolor}
\usepackage[normalem]{ulem}
\usepackage{soul}
\usepackage{color}
\usepackage{booktabs}
\usepackage[textsize=footnotesize,tickmarkheight=3pt]{todonotes}
\usepackage{setspace}
% MATHS %
\usepackage{amsmath}
\usepackage{amsthm}
\usepackage{amssymb}
\usepackage{bigints}
\usepackage{mathrsfs}
\usepackage{xfrac}
\usepackage{yfonts}
\usepackage{mathtools}
\usepackage{upgreek}
\usepackage{nccmath}
\usepackage{scalerel}
\usepackage{accents}
\usepackage{nicefrac}
\usepackage{mathtools}
\usepackage{subcaption}
\usepackage[labelfont=bf]{caption}
\usepackage{changepage}
\usepackage{enumitem}
\usepackage{eurosym}
\usepackage{indentfirst}
\usepackage{bibentry}
\usepackage{pifont}
\setlength\parindent{0pt}
\bibliographystyle{myauthordate3}
\setcitestyle{authoryear,round,semicolon,}
\titleformat{\paragraph}[hang]
{\normalfont\normalsize\bfseries}{}{1em}{}
\titlespacing*{\paragraph}{0pt}{3.25ex plus 1ex minus .2ex}{1.5ex plus .2ex}
\titleformat{\subparagraph}
{\normalfont\normalsize\bfseries}{\thesubparagraph}{1em}{}
\titlespacing*{\subparagraph}{\parindent}{3.25ex plus 1ex minus .2ex}{.75ex plus .1ex}
\makeatletter
\def\today{%
\two@digits{\the\day}-%
\ifcase\month\or%
Jan\or Feb\or Mar\or Apr\or May\or Jun\or%
Jul\or Aug\or Sep\or Oct\or Nov\or Dec\fi-%
\number\year%
}
\makeatother
\newcommand{\indicator}[1]{\mathbbm{1}_{\{#1\}}}
\newcommand{\sgn}{\mathrm{sgn}}
\makeatletter
\newcommand{\vast}{\bBigg@{4}}
\newcommand{\Vast}{\bBigg@{5}}
\makeatother
Best Answer
The
scalerel
package loadscalc
. Once the latter package is called, it's not possible to set muskips with\setlength
.Just do
instead of
\setlength
.