![矩阵中的文本无法容纳在一行中](https://linux22.com/image/357308/%E7%9F%A9%E9%98%B5%E4%B8%AD%E7%9A%84%E6%96%87%E6%9C%AC%E6%97%A0%E6%B3%95%E5%AE%B9%E7%BA%B3%E5%9C%A8%E4%B8%80%E8%A1%8C%E4%B8%AD.png)
我试图将变量放入我的文档中,但它无法放在一行中,而且会超出页面的某个地方...我尝试了一些不同的东西,比如\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}