저는 Overleaf를 사용하여 수학 공식과 제약 조건을 작성하고 있습니다. 이것은 내 코드이며 내가 얻은 결과도 보여줍니다(그림 참조). 보시다시피 수식이 잘 정렬되지 않았습니다. 모든 수식을 정렬하고 레이블(그림에 표시된 대로 숫자 포함)을 지정하여 레이아웃을 개선하고 싶습니다. 누군가가 이 문제를 도와줄 수 있다면 매우 도움이 될 것입니다!
\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage[super]{natbib}
\usepackage{comment}
\usepackage{graphicx}
\usepackage{float}
\usepackage{hyperref}
\usepackage{amsmath}
\usepackage{amssymb}
\usepackage{amsfonts}
\usepackage{caption}
\usepackage{adjustbox}
\usepackage{lipsum}
\usepackage{lscape}
\usepackage{multicol}
\usepackage{longtable}
\captionsetup[figure]{font=small,labelfont=bf}
\captionsetup[table]{font=small,labelfont=bf}
\usepackage[justification=centering]{caption}
\usepackage{eurosym}
\usepackage{mhchem}
\usepackage{relsize}
\usepackage[table, dvipsnames]{xcolor}
\renewcommand*\descriptionlabel[1]{\hspace\leftmargin$#1$}
\usepackage[hidelinks]{hyperref}
\usepackage{enumitem}
\usepackage{glossaries}
\makeglossaries
\newcommand{\mathgl}[2]{
\newglossaryentry{#1}{name={#1},description={#2}}
\begin{description}[labelwidth=2cm]
\item[\gls{#1}]#2
\end{description}
}
\makeatletter
\newcommand*{\rom}[1]{\expandafter\@slowromancap\romannumeral #1@}
\makeatother
\def\changemargin#1#2{\list{}{\rightmargin#2\leftmargin#1}\item[]}
\let\endchangemargin=\endlist
\begin{document}
\subsection{Stating the objective function}
TextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextText
\begin{align}
\min \quad BFC \cdot \bigg(\mathlarger{\mathlarger{\sum}}_{i\in I}Fc_i \cdot u_i\bigg)
+
BEC \cdot \bigg(\mathlarger{\mathlarger{\sum}}_{i\in I}\mathlarger{\mathlarger{\sum}}_{j \in J}\mathlarger{\mathlarger{\sum}}_{p \in P}x_i_j_p\cdot Ec_i_j_p_y\bigg)
+
BTC \cdot \bigg(\mathlarger{\mathlarger{\sum}}_{i\in I}\mathlarger{\mathlarger{\sum}}_{j \in J}\mathlarger{\mathlarger{\sum}}_{p \in P}x_i_j_p\cdot Tc_i_j_p\bigg)
+
BWC \cdot \bigg(\mathlarger{\mathlarger{\sum}}_{i\in I}\mathlarger{\mathlarger{\sum}}_{j \in J}\mathlarger{\mathlarger{\sum}}_{p \in P}x_i_j_p\cdot Wc_i_j_p\bigg)
+
BZC \cdot \bigg(\mathlarger{\mathlarger{\sum}}_{i\in I}\mathlarger{\mathlarger{\sum}}_{j \in J}\mathlarger{\mathlarger{\sum}}_{p \in P}x_i_j_p\cdot Z_i_j_p\bigg)\cdot Zc
\label{1}
\end{align}
\subsection{Stating the constraints}
The first constraint ensures that the demand of each customer is satisfied:
\begin{align}
\mathlarger{\sum}_{i\in I}x_i_j_p = D_j_p_y, \quad && \forall j \in J, p\in P, y \in Y\label{2}
\end{align}
\noindent The second formula makes sure that the maximum capacity of each supplier facility is not exceeded:
\begin{align}
\mathlarger{\sum}_{j\in J}\mathlarger{\sum}_{p\in P}x_i_j_p \leq u_i, \quad && \forall i \in I \label{3}
\end{align}
\noindent Contracts with specific supplier facilities may agree on minimum allocation volumes. This is ensured by the following formula:
\begin{align}
\mathlarger{\sum}_{j\in J}\mathlarger{\sum}_{p\in P}x_i_j_p \geq V_i, \quad && \forall i \in I \label{3}
\end{align}
\noindent Specific breweries desire to be supplied by at least two suppliers for some specific type of product code. This is ensured by the following two formulas:
\begin{align}
\mathlarger{\sum}_{i\in I}J_i_j_p \geq 2, \quad && \forall j \in J, p\in P \label{4}\\
x_i_j_p \geq b_i_j_p M_j_p
\end{align}
\noindentSpecific OpCos desire to be supplied by at least two suppliers for some specific type of product code. This is ensured by the following two formulas:
\begin{align}
\mathlarger{\sum}_{i\in I}F_i_o_p\geq 2,\quad && \forall o \in O, p\in P \label{5}\\
\mathlarger{\sum}_{i\subset I}x_i_j_p \geq F_i_o_pG_o_p,\quad && \forall i \in I, o\in O, p\in P \label{5}
\end{align}
답변1
간단한 솔루션은 단일 align
환경과 \intertext
명령을 사용합니다.
코드가 작동하는 데 필요한 내용으로 서문을 단순화했습니다. 또한, 나는 당신이 double 을 사용할 필요가 없다고 생각합니다. 이를 \mathlarger
사용하면 방정식 번호가 방정식 아래에 놓이게 됩니다.multlined
amsfonts
그런데, 로드할 때 로드할 필요는 없습니다 amssymb
. 후자가 대신해 줍니다. hyperref
거의 예외 없이 마지막 패키지로 로드되어야 합니다 .
\documentclass{article}
\usepackage{mathtools}
\usepackage{amssymb}
\usepackage{relsize}
\usepackage[hidelinks]{hyperref}
\begin{document}
\setcounter{section}{4}
\setcounter{subsection}{5}
\subsection{Stating the objective function}
Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text
\begin{equation}
\begin{multlined}
\min \quad BFC \cdot \bigg(\mathlarger{\sum}_{i\in I}Fc_i \cdot u_i\bigg)
+
BEC \cdot \bigg(\mathop{\mathlarger{\sum}_{i\in I}\mathlarger{\sum}_{j \in J}\mathlarger{\sum}_{p \in P}x_{i j p}}\cdot Ec_{ijpy}\bigg) +{}
\\
BTC \cdot \bigg(\mathlarger{\sum}_{i\in I}\mathlarger{\sum}_{j \in J}\mathlarger{\sum}_{p \in P}x_{ijp}\cdot Tc_{ijp}\bigg)
+
BWC \cdot \bigg(\mathlarger{\sum}_{i\in I}\mathlarger{\sum}_{j \in J}\mathlarger{\sum}_{p \in P}x_{ijp}\cdot Wc_{ijp}\bigg)
\\
+ BZC \cdot \bigg(\mathlarger{\sum}_{i\in I}\mathlarger{\sum}_{j \in J}\mathlarger{\sum}_{p \in P}x_{ijp}\cdot Z_{ijp}\bigg)\cdot Zc
\end{multlined}
\label{1}
\end{equation}
\subsection{Stating the constraints}
The first constraint ensures that the demand of each customer is satisfied:
\begin{align}
\mathlarger{\sum}_{i\in I}&x_{ijp} = D_{jpy}, \quad && \forall j \in J, p\in P, y \in Y\label{2} \\
\intertext{The second formula makes sure that the maximum capacity of each supplier facility is not exceeded:}
\mathlarger{\sum}_{j\in J}\mathlarger{\sum}_{p\in P} &x_{ijp} \leq u_i, \quad && \forall i \in I \label{3}
\intertext{Contracts with specific supplier facilities may agree on minimum allocation volumes. This is ensured by the following formula:}
\mathlarger{\sum}_{j\in J} \mathlarger{\sum}_{p\in P} &x_{ijp}\geq V_i, \quad && \forall i \in I \label{3} \\
\intertext{Specific breweries desire to be supplied by at least two suppliers for some specific type of product code. This is ensured by the following two formulas:}
\mathlarger{\sum}_{i\in I}&J_{ijp} \geq 2, \quad && \forall j \in J, p\in P \label{4}\\
&x_{ijp} \geq b_{ijp} M_{jp}\\
\intertext{Specific OpCos desire to be supplied by at least two suppliers for some specific type of product code. This is ensured by the following two formulas:}
\mathlarger{\sum}_{i\in I}&F_{iop} \geq 2,\quad && \forall o \in O, p\in P \label{5}\\
\mathlarger{\sum}_{i\subset I}&x_{ijp} \geq F_{iop} G_{op},\quad && \forall i \in I, o\in O, p\in P \label{5}
\end{align}
\end{document}
답변2
다음은 확장된 예입니다.
\documentclass[a4paper,12pt]{article}
\usepackage{mathtools}
\usepackage{lipsum}
\begin{document}
\section{Let us try}
\subsection{Stating the objective function}
%\lipsum[1]
\begin{equation}\label{1}
\begin{aligned}
\min \quad BFC \bigg(\sum_{i\in I}Fc_i u_i\bigg)
&+ BEC \biggl(\sum_{i\in I} \sum_{j \in J} \sum_{p \in P} x_{ijp} Ec_{ijp} y \biggr) \\
&+ BTC \biggl(\sum_{i\in I} \sum_{j \in J} \sum_{p \in P} x_{ijp} Tc_{ijp} \biggr) \\
&+ BWC \biggl(\sum_{i\in I} \sum_{j \in J} \sum_{p \in P} x_{ijp} Wc_{ijp} \biggr) \\
&+ BZC \biggl(\sum_{i\in I} \sum_{j \in J} \sum_{p \in P} x_{ijp} Z_{ijp} \biggr) Zc
\end{aligned}
\end{equation}
\subsection{Stating the constraints}
The first constraint ensures that the demand of each customer is satisfied:
\begin{align}\label{2}\allowdisplaybreaks
&\sum_{i\in I} x_{ijp} = D_{jpy}, \quad && \forall j \in J, p\in P, y \in Y\\
\intertext{The second formula makes sure that the maximum}
&\sum_{j\in J}\sum_{p\in P} x_{ijp} \leq u_i, \quad && \forall i \in I \label{3}
\intertext{Specific breweries desire to be supplied by at least two suppliers for some specific type
of product code. This is ensured by the following two formulas:}
&\sum_{i\in I}J_{ijp} \geq 2, \quad && \forall j \in J, p\in P \label{4}\\
&x_{ijp} \geq b_{ijp} M_{jp}\label{5}
\end{align}
\end{document}
결과가 당신에게 적합한 지 확인하십시오. 그렇다면 쉽게 확장할 수 있습니다.
답변3
가 없는 내 버전에서는 \mathlarger
괄호가 줄어들고 몇 가지 다른 힌트가 있습니다.
예를 들어,BFC첫 번째 디스플레이의 유사한 기호는 세 가지 수량의 곱이 아니라 단일 변수를 의미하므로 \mathit
문자 사이의 간격을 줄입니다. 다른 사람들이 말한 것과는 달리, \cdot
기호가 "평가된 함수"로 해석되는 것을 피하기 위해 필요합니다.
단지 가 아닌 \biggl(
and 를 사용해야 합니다 . 어쨌든 일반 크기의 버전 이 더 좋아 보입니다. 아래 첨자가 괄호와 충돌할 수 있으면 추가하세요 .\biggr)
\bigg
\sum
\Big
\,
마지막 을 확인하세요 i\subset I
. 적합하지 않은 것 같습니다.
당신은 고려할 수 있습니다
\sum_{\substack{i\in I \\ j\in J \\ p\in P}}
삼중 합산 대신에 이중 합산도 마찬가지입니다.
표시하기 전에 빈 줄을 피하십시오. 표시 뒤에 빈 줄이 없으면 필요하지 않습니다 \noindent
(빈 줄이 있으면 \noindent
잘못된 것입니다).
\documentclass{article}
\usepackage{amsmath}
\newcommand{\tvar}[1]{\mathit{#1}}
\begin{document}
\subsection{Stating the objective function}
Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text
Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text
Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text
Text Text Text
\begin{equation}\label{1}
\begin{split}
\min \tvar{BFC} &\cdot \Bigl(\,\sum_{i\in I} Fc_i \cdot u_i\Bigr)
+
\tvar{BEC} \cdot \Bigl(\,\sum_{i\in I}\sum_{j \in J}\sum_{p \in P}x_{ijp} \tvar{Ec}_{ijpy}\Bigr)
\\
{}+
\tvar{BTC} &\cdot \Bigl(\,\sum_{i\in I}\sum_{j \in J}\sum_{p \in P}x_{ijp} \tvar{Tc}_{ijp}\Bigr)
+
\tvar{BWC} \cdot \Bigl(\,\sum_{i\in I}\sum_{j \in J}\sum_{p \in P}x_{ijp} \tvar{Wc}_{ijp}\Bigr)
\\
{}+
\tvar{BZC} &\cdot \Bigl(\,\sum_{i\in I}\sum_{j \in J}\sum_{p \in P}x_{ijp} Z_{ijp}\Bigr) \tvar{Zc}
\end{split}
\end{equation}
\subsection{Stating the constraints}
The first constraint ensures that the demand of each customer is satisfied:
\begin{equation}\label{2}
\sum_{i\in I}x_{ijp} = D_{jpy}, \quad \forall j \in J, p\in P, y \in Y
\end{equation}
The second formula makes sure that the maximum capacity of each supplier facility
is not exceeded:
\begin{equation}\label{3}
\sum_{j\in J}\sum_{p\in P}x_{ijp} \leq u_i, \quad \forall i \in I
\end{equation}
Contracts with specific supplier facilities may agree on minimum allocation volumes.
This is ensured by the following formula:
\begin{equation}\label{4}
\sum_{j\in J}\sum_{p\in P}x_{ijp} \geq V_i, \quad \forall i \in I
\end{equation}
Specific breweries desire to be supplied by at least two suppliers for some specific
type of product code. This is ensured by the following two formulas:
\begin{equation}\label{5}
\sum_{i\in I}J_{ijp} \geq 2, \quad \forall j \in J, p\in P
x_{ijp} \geq b_{ijp} M_{jp}
\end{equation}
Specific OpCos desire to be supplied by at least two suppliers for some specific
type of product code. This is ensured by the following two formulas:
\begin{alignat}{2}
&\sum_{i\in I}F_{iop}\geq 2, &\quad& \forall o \in O, p\in P \label{6}\\
&\sum_{i\subset I}x_{ijp} \geq F_{iop}G_{op}, && \forall i \in I, o\in O, p\in P \label{7}
\end{alignat}
\end{document}
여기에 버전이 있습니다\substack
답변4
multline
첫 번째 방정식의 경우 환경( amsmath
패키지에 정의됨) 을 사용할 수 있습니다 .
\documentclass{article}
\usepackage{amsmath, amssymb}
\usepackage{lipsum}
\begin{document}
\subsection{Stating the objective function}
\lipsum[11]
\begin{multline}\label{1}
\min \quad \mathrm{BFC}{\cdot}\bigg(\sum_{i\in I}Fc_i{\cdot} u_i\bigg)
+ \mathrm{BEC}{\cdot}\bigg(\sum_{i\in I}\sum_{j \in J}\sum_{p \in P}x_{ijp}{\cdot}Ec_{ijpy}\bigg) \\
%
+ \mathrm{BTC}{\cdot}\bigg(\sum_{i\in I}\sum_{j \in J}\sum_{p \in P}x_{ijp}{\cdot}Tc_{ijp}\bigg)
+ \mathrm{BWC}{\cdot}\bigg(\sum_{i\in I}\sum_{j \in J}\sum_{p \in P}x_{ijp}{\cdot}Wc_{ijp}\bigg) \\
%
+ \mathrm{BZC}{\cdot}\bigg(\sum_{i\in I}\sum_{j \in J}\sum_{p \in P}x_{ijp}{\cdot}Z_{ijp}\bigg){\cdot}Zc
\end{multline}
\end{document}
\subsection{Stating the constraints}
The first constraint ensures that the demand of each customer is satisfied:
\begin{align}
\mathlarger{\sum}_{i\in I}x_i_j_p = D_j_p_y, \quad && \forall j \in J, p\in P, y \in Y\label{2}
\end{align}
\noindent The second formula makes sure that the maximum capacity of each supplier facility is not exceeded:
\begin{align}
\mathlarger{\sum}_{j\in J}\mathlarger{\sum}_{p\in P}x_i_j_p \leq u_i, \quad && \forall i \in I \label{3}
\end{align}
\noindent Contracts with specific supplier facilities may agree on minimum allocation volumes. This is ensured by the following formula:
\begin{align}
\mathlarger{\sum}_{j\in J}\mathlarger{\sum}_{p\in P}x_i_j_p \geq V_i, \quad && \forall i \in I \label{3}
\end{align}
\noindent Specific breweries desire to be supplied by at least two suppliers for some specific type of product code. This is ensured by the following two formulas:
\begin{align}
\mathlarger{\sum}_{i\in I}J_i_j_p \geq 2, \quad && \forall j \in J, p\in P \label{4}\\
x_i_j_p \geq b_i_j_p M_j_p
\end{align}
\noindentSpecific OpCos desire to be supplied by at least two suppliers for some specific type of product code. This is ensured by the following two formulas:
\begin{align}
\mathlarger{\sum}_{i\in I}F_i_o_p\geq 2,\quad && \forall o \in O, p\in P \label{5}\\
\mathlarger{\sum}_{i\subset I}x_i_j_p \geq F_i_o_pG_o_p,\quad && \forall i \in I, o\in O, p\in P \label{5}
\end{align}
\end{document}
생산하는 것 :
일부 의견:
- 방정식에서 일부 기호의 크기를 늘리는 것은(귀하의 경우
\sum
) 좋은 생각이 아닙니다. 그들의 크기는 멋지게 보이는 방정식을 위해 의도적으로 제작되었으므로 디자이너의 노력을 파괴하지 마십시오. BFC
, 등은 약어 라고 생각합니다 . 이는 upshape 글꼴로 작성해야 합니다. 즉 , , `\mathbf{BTC}˙ 등BTC
으로 작성해야 합니다.\mathrm{BFC}
- 마찬가지로
c_i_j_p_y
잘못된 표기법입니다. 그것은 orc_{ijpy}
(어느 결과가 가장 바람직할지) 또는c_{i_{j_{p_{y}}}}
(어느 쪽이 덜 가능성이 높을지) 이어야 합니다. \cdot
수학적 관점에서 곱셈을 사용하는 것은 필요하지 않습니다. 어쨌든 계속 사용한다면 중괄호로 묶어서 주변 공간을 줄일 수 있습니다(위의 MWE에서 수행된 것처럼).