Latex语法学习10:盒子的使用(fbox, tcolorbox, boitee),支持设置颜色和换页

目录

1 \fbox

 2 彩色的盒子(可换页)

 3 boitee环境


1 \fbox

这段代码主要用到了三个命令:

  • \noindent:表示取消缩进
  • \textwidth:表示设置盒子宽度为页面宽度
\noindent \fbox{\parbox{\textwidth}{%
子问题2:\\
Maximize
 43.8 Y[0,0] + 43.8 Y[0,1] + 10.5 Y[1,0] + 10.5 Y[1,1] + 33.9 Y[2,0]
+ 33.9 Y[2,1] + 45.9 Y[3,0] + 45.9 Y[3,1]
Subject To\\
R0: 37 X[0,0] + 26 X[1,0] + 28 X[2,0] + 30 X[3,0] + 24 X[4,0] + 98 Y[0,0] + 97 Y[1,0] + 37 Y[2,0] + 49 Y[3,0]
<= 70\\
R1: 37 X[0,1] + 26 X[1,1] + 28 X[2,1] + 30 X[3,1] + 24 X[4,1] + 98 Y[0,1] + 97 Y[1,1] + 37 Y[2,1] + 49 Y[3,1]
<= 60\\
R2: Y[0,0] + Y[0,1] <= 1\\
R3: Y[1,0] + Y[1,1] <= 1\\
R4: Y[2,0] + Y[2,1] <= 1\\
R5: Y[3,0] + Y[3,1] <= 1\\
Bounds\\
Binaries\\
X[0,0] X[0,1] X[1,0] X[1,1] X[2,0] X[2,1] X[3,0] X[3,1] X[4,0] X[4,1]
Y[0,0] Y[0,1] Y[1,0] Y[1,1] Y[2,0] Y[2,1] Y[3,0] Y[3,1]\\
End
}}

Latex语法学习10:盒子的使用(fbox, tcolorbox, boitee),支持设置颜色和换页_第1张图片

 2 彩色的盒子(可换页)

需要引入的环境:

\usepackage[skins]{tcolorbox} %必须标注skin,才能使用shadow命令显示阴影。
\tcbuselibrary{breakable} %breakable:支持跨页

实现代码:

  • drop shadow southeast:设置阴影在东南方向
  • breakable:支持自动翻页
  • colback=red!5!white:设置背景颜色
  • colframe=red!75!black:设置外框颜色
\begin{tcolorbox}[drop shadow southeast, enhanced,colback=red!5!white,colframe=red!75!black,breakable] % 在 tcolorbox 中添加 breakable 选项
	子问题2:\\
	Maximize
	43.8 Y[0,0] + 43.8 Y[0,1] + 10.5 Y[1,0] + 10.5 Y[1,1] + 33.9 Y[2,0]
	+ 33.9 Y[2,1] + 45.9 Y[3,0] + 45.9 Y[3,1]
	Subject To\\
	R0: 37 X[0,0] + 26 X[1,0] + 28 X[2,0] + 30 X[3,0] + 24 X[4,0] + 98 Y[0,0] + 97 Y[1,0] + 37 Y[2,0] + 49 Y[3,0]
	<= 70\\
	R1: 37 X[0,1] + 26 X[1,1] + 28 X[2,1] + 30 X[3,1] + 24 X[4,1] + 98 Y[0,1] + 97 Y[1,1] + 37 Y[2,1] + 49 Y[3,1]
	<= 60\\
	R2: Y[0,0] + Y[0,1] <= 1\\
	R3: Y[1,0] + Y[1,1] <= 1\\
	R4: Y[2,0] + Y[2,1] <= 1\\
	R5: Y[3,0] + Y[3,1] <= 1\\
	Bounds\\
	Binaries\\
	X[0,0] X[0,1] X[1,0] X[1,1] X[2,0] X[2,1] X[3,0] X[3,1] X[4,0] X[4,1]
	Y[0,0] Y[0,1] Y[1,0] Y[1,1] Y[2,0] Y[2,1] Y[3,0] Y[3,1]\\
	End
\end{tcolorbox}

Latex语法学习10:盒子的使用(fbox, tcolorbox, boitee),支持设置颜色和换页_第2张图片

 3 boitee环境

需要引入的环境:

\usepackage{boites,boites_exemples}

盒子的内容代码:

\begin{boiteepaisseavecuntitre}{ 例题1:两阶段随机规划模型的拓展式数值形式 }
	95 X[0,0] + 95 X[0,1] + 51 X[1,0] + 51 X[1,1] + 77 X[2,0] + 77 X[2,1]
	+ 50 X[3,0] + 50 X[3,1] + 65 X[4,0] + 65 X[4,1] + 17.1 Y[0,0,0]
	+ 43.8 Y[0,0,1] + 61.6 Y[0,0,2] + 17.1 Y[0,1,0] + 43.8 Y[0,1,1]
	+ 61.6 Y[0,1,2] + 20.1 Y[1,0,0] + 10.5 Y[1,0,1] + 27.2 Y[1,0,2]
	+ 20.1 Y[1,1,0] + 10.5 Y[1,1,1] + 27.2 Y[1,1,2] + 6.3 Y[2,0,0]
	+ 33.9 Y[2,0,1] + 68 Y[2,0,2] + 6.3 Y[2,1,0] + 33.9 Y[2,1,1]
	+ 68 Y[2,1,2] + 44.7 Y[3,0,0] + 45.9 Y[3,0,1] + 6.8 Y[3,0,2]
	+ 44.7 Y[3,1,0] + 45.9 Y[3,1,1] + 6.8 Y[3,1,2] \\
	Subject To  \\
	R0: 37 X[0,0] + 26 X[1,0] + 28 X[2,0] + 30 X[3,0] + 24 X[4,0] <= 70 \\
	R1: 37 X[0,1] + 26 X[1,1] + 28 X[2,1] + 30 X[3,1] + 24 X[4,1] <= 60 \\
	R2: X[0,0] + X[0,1] <= 1 \\
	R3: X[1,0] + X[1,1] <= 1 \\
	R4: X[2,0] + X[2,1] <= 1 \\
	R5: X[3,0] + X[3,1] <= 1 \\
	R6: X[4,0] + X[4,1] <= 1 \\
	R7: 37 X[0,0] + 26 X[1,0] + 28 X[2,0] + 30 X[3,0] + 24 X[4,0]
	+ 98 Y[0,0,0] + 97 Y[1,0,0] + 37 Y[2,0,0] + 49 Y[3,0,0] <= 70 \\
	R8: 37 X[0,0] + 26 X[1,0] + 28 X[2,0] + 30 X[3,0] + 24 X[4,0]
	+ 98 Y[0,0,1] + 97 Y[1,0,1] + 37 Y[2,0,1] + 49 Y[3,0,1] <= 70 \\
	R9: 37 X[0,0] + 26 X[1,0] + 28 X[2,0] + 30 X[3,0] + 24 X[4,0]
	+ 98 Y[0,0,2] + 97 Y[1,0,2] + 37 Y[2,0,2] + 49 Y[3,0,2] <= 70 \\ 
	R10: 37 X[0,1] + 26 X[1,1] + 28 X[2,1] + 30 X[3,1] + 24 X[4,1]
	+ 98 Y[0,1,0] + 97 Y[1,1,0] + 37 Y[2,1,0] + 49 Y[3,1,0] <= 60 \\
	R11: 37 X[0,1] + 26 X[1,1] + 28 X[2,1] + 30 X[3,1] + 24 X[4,1]
	+ 98 Y[0,1,1] + 97 Y[1,1,1] + 37 Y[2,1,1] + 49 Y[3,1,1] <= 60 \\
	R12: 37 X[0,1] + 26 X[1,1] + 28 X[2,1] + 30 X[3,1] + 24 X[4,1] 
	+ 98 Y[0,1,2] + 97 Y[1,1,2] + 37 Y[2,1,2] + 49 Y[3,1,2] <= 60 \\
	R13: Y[0,0,0] + Y[0,1,0] <= 1 \\
	R14: Y[0,0,1] + Y[0,1,1] <= 1 \\
	R15: Y[0,0,2] + Y[0,1,2] <= 1 \\
	R16: Y[1,0,0] + Y[1,1,0] <= 1 \\
	R17: Y[1,0,1] + Y[1,1,1] <= 1 \\
	R18: Y[1,0,2] + Y[1,1,2] <= 1 \\
	R19: Y[2,0,0] + Y[2,1,0] <= 1 \\
	R20: Y[2,0,1] + Y[2,1,1] <= 1 \\
	R21: Y[2,0,2] + Y[2,1,2] <= 1 \\
	R22: Y[3,0,0] + Y[3,1,0] <= 1 \\
	R23: Y[3,0,1] + Y[3,1,1] <= 1 \\
	R24: Y[3,0,2] + Y[3,1,2] <= 1 \\
	Bounds \\
	Binaries \\
	X[0,0] X[0,1] X[1,0] X[1,1] X[2,0] X[2,1] X[3,0] X[3,1] X[4,0] X[4,1] \\
	Y[0,0,0] Y[0,0,1] Y[0,0,2] Y[0,1,0] Y[0,1,1] Y[0,1,2] Y[1,0,0] Y[1,0,1] \\
	Y[1,0,2] Y[1,1,0] Y[1,1,1] Y[1,1,2] Y[2,0,0] Y[2,0,1] Y[2,0,2] Y[2,1,0] \\
	Y[2,1,1] Y[2,1,2] Y[3,0,0] Y[3,0,1] Y[3,0,2] Y[3,1,0] Y[3,1,1] Y[3,1,2] \\
	End 
\end{boiteepaisseavecuntitre}

代码的执行效果:

Latex语法学习10:盒子的使用(fbox, tcolorbox, boitee),支持设置颜色和换页_第3张图片

 参考资料:

  1. 如何将LaTeX中的盒子分页? - 知乎
  2. 简单好用的可以跨页的盒子 - 无需大型宏包支持 - LaTeX 工作室

你可能感兴趣的:(Latex公式的编写,学习)