我试图将变量放入我的文档中,但它无法放在一行中,而且会超出页面的某个地方...我尝试了一些不同的东西,比如\begin{split}
或\begin{align}
或只是"\\"
,但它似乎不起作用...还有其他想法吗?
\documentclass[paper=a4,fontsize=11pt,twoside=semi,usegeometry]{scrreprt}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage[english]{babel}
\usepackage{microtype}
\usepackage{amsmath,amsfonts,amsthm,amssymb}
\usepackage{newtxtext,newtxmath}
\usepackage{graphicx}
\usepackage{blindtext}
\usepackage{fancyhdr}
\usepackage{tocloft}
\usepackage{ragged2e}
\addtokomafont{disposition}{\rmfamily}
\RedeclareSectionCommand[
beforeskip=-1sp,
afterskip=.5cm,
font=\Huge
]{chapter}
\begin{document}
\pagestyle{fancy}
\fancyhf{}
\fancyhead[CE,CO]{\leftmark}
\fancyfoot[LE,RO]{\thepage}
\renewcommand{\headrulewidth}{2pt}
\renewcommand{\footrulewidth}{1pt}
\chapter{chapter}
\normalsize
\setlength{\parindent}{0pt}
\begin{equation}
y = \left\{\begin{matrix}
& 1 & \text{\text{if curve $c \in C$ applies cant size $k \in K$ and speed $s \in S$ and curve $c+1 \in C$ applies cant size $p \in K$ and speed $q \in S$}}\\
& 0 & \text{Otherwise}
\end{matrix}\right.
\end{equation}
答案1
\documentclass[paper=a4,fontsize=11pt,twoside=semi,usegeometry]{scrreprt}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage[english]{babel}
\usepackage{microtype}
\usepackage{amsmath,amsfonts,amsthm,amssymb}
\usepackage{newtxtext,newtxmath}
\usepackage{graphicx}
\usepackage{blindtext}
\usepackage{fancyhdr}
\usepackage{tocloft}
\usepackage{ragged2e}
\addtokomafont{disposition}{\rmfamily}
\RedeclareSectionCommand[
beforeskip=-1sp,
afterskip=.5cm,
font=\Huge
]{chapter}
\begin{document}
\pagestyle{fancy}
\fancyhf{}
\fancyhead[CE,CO]{\leftmark}
\fancyfoot[LE,RO]{\thepage}
\renewcommand{\headrulewidth}{2pt}
\renewcommand{\footrulewidth}{1pt}
\chapter{chapter}
\normalsize
\setlength{\parindent}{0pt}
\begin{equation}
y = \left\{\begin{matrix}
& 1 & \text{\text{if curve $c \in C$ applies cant size $k \in K$ and speed $s \in S$ and curve $c+1 \in C$ applies cant size $p \in K$ and speed $q \in S$}}\\
& 0 & \text{Otherwise}
\end{matrix}\right.
\end{equation}
\begin{equation}
y = \left\{\begin{array}{lp{10cm}}
1 & if curve $c \in C$ applies cant size $k \in K$ and speed $s \in S$ and curve $c+1 \in C$ applies cant size $p \in K$ and speed $q \in S$ \\
0 & \text{Otherwise}
\end{array}\right.
\end{equation}
\end{document}