这是我的代码-
\documentclass[12pt]{book}
\usepackage[utf8]{inputenc}
\usepackage{amsmath}
\usepackage{amssymb}
\usepackage{graphicx}
\usepackage{syntonly}
\usepackage{amsthm}
\usepackage{parskip}
\usepackage{tabularray}
%xparse package needed for physics package to work properly
\usepackage{xparse}
% Font encoding
\usepackage[T1]{fontenc}
\usepackage[version=4]{mhchem}
\usepackage{chemfig}
%For colours
\usepackage[x11names]{xcolor}
%Defining colours
\definecolor{Rust}{HTML}{BF3100}
\definecolor{Orange yellow}{HTML}{EEB902}
\definecolor{Vermillion}{HTML}{D52D0B}
\definecolor{Imperial Red}{HTML}{E63946}
\definecolor{Honeydew}{HTML}{F1FAEE}
\definecolor{Powder Blue}{HTML}{A8DADC}
\definecolor{Atomic Tangerine}{HTML}{F39C6B}
\definecolor{Selective yellow}{HTML}{FFB703}
\definecolor{Prussian blue}{HTML}{033063}
\definecolor{Raisin black}{HTML}{272838}
%%%%%%%%%%%%%%%%%%%%COLOURSCHEME%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%COLOURSCHEME%%%%%%%%%%%%%%%%%%%
%Definitions header
\definecolor{Yale blue}{HTML}{084B83}
% definition boxes colour [colback=Powder blue!50!white, colframe=Powder blue!50!white]
\definecolor{Powder blue}{HTML}{BBE6E4}
%Examples header
\definecolor{Indian red}{HTML}{DB5461}
%Examples box [colback=Unbleached silk!65!white, colframe=Unbleached silk!65!white]
\definecolor{Unbleached silk}{HTML}{FFD9CE}
%Margin notes colour (Linen!60!white)
\definecolor{Linen}{HTML}{F9EAE1}
%%%%%%%%%%%%%%%%%%%%COLOURSCHEME%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%COLOURSCHEME%%%%%%%%%%%%%%%%%%%
%Package for fixing bugs when using marginnotes
\usepackage{mparhack}
%For Garmond font
\usepackage{garamondlibre}
%Float package
\usepackage{float}
%Continue to enumerate
\usepackage{enumitem}
\usepackage{tcolorbox}
%layout package
\usepackage{layout}
%geometry package
\usepackage{geometry}
\geometry{papersize={23cm,28cm}, right=9.3cm, left=3cm, top=2.5cm, bottom=3cm, marginparwidth=4.8cm, marginparsep=1.5cm, headheight=0cm}
%marginparpush=2cm
%fancyheaders
\usepackage{fancyhdr}
\pagestyle{fancy}
\fancyhead[LO,RE]{\chaptername\ \thechapter}
\fancyfoot{}
\fancyfoot[LO,RE]{\thepage}
%Packages for Maxwell-Boltzmann distribution
\usepackage{pgfplots,siunitx}
%Wrapping lines of text package
\usepackage{seqsplit}
%For the unit of rate constant table
\usepackage{tabularray}
\UseTblrLibrary{amsmath, siunitx}
%Package for striking out terms in a calculation
\usepackage{cancel}
\usepackage{xfrac}
%Package for inserting figures in margin notes
\usepackage{sidenotes}
%packages required for sidenotes package to work correctly
\usepackage{marginnote}
\usepackage{xparse}
\usepackage{caption}
\usepackage{l3keys2e}
\usepackage{changepage}
%package for landscape tables
\usepackage{rotating}
\usepackage{array}
\newcolumntype{L}{>{\centering\arraybackslash}m{3cm}}
%Defining a new column type for the alkyl groups table
\newcolumntype{A}{>{\centering\arraybackslash}m{2cm}}
\newcolumntype{B}{>{\centering\arraybackslash}m{3.4cm}}
\newcolumntype{C}{>{\centering\arraybackslash}m{1.7cm}}
\newcolumntype{D}{>{\centering\arraybackslash}m{4cm}}
%Defining a new column type for the cis-trans isomers table
\newcolumntype{E}{>{\centering\arraybackslash}m{7cm}}
\newcolumntype{F}{>{\centering\arraybackslash}m{3cm}}
\newcolumntype{G}{>{\centering\arraybackslash}m{8cm}}
%For the free radical substitution reaction
\newenvironment{f}{$\displaystyle\aligned}{\endaligned$}
%to fix overlflowing margin notes
\usepackage{marginfix}
% Diagrams from mathcha
\usepackage{physics}
\usepackage{tikz}
\usepackage{mathdots}
\usepackage{yhmath}
\usepackage{cancel}
\usepackage{color}
\usepackage{siunitx}
\usepackage{array}
\usepackage{multirow}
\usepackage{gensymb}
\usepackage{tabularx}
\usepackage{extarrows}
\usepackage{booktabs}
\usetikzlibrary{fadings}
\usetikzlibrary{patterns}
\usetikzlibrary{shadows.blur}
\usetikzlibrary{shapes}
\usetikzlibrary{arrows.meta}
\begin{document}
For example -
\begin{tcolorbox}[colback=Powder blue!50!white, colframe=Powder blue!50!white]
\begin{align*}
\ce{\textstyle\frac{1}{2}Br2(l) & ->[\Delta H_{at}^{\ominus}]Br(g)}\\
\ce{\textstyle\frac{1}{2}Cl2(g) & ->[\Delta H_{\text{at}}^{\ominus}] Cl(g)}\ \ \ \ \Delta H_{at}^{\ominus}=+121\ \unit{kJ\ mol^{-1}}\\
\ce{Na(s) & ->[\Delta H_{at}^{\ominus}] Na(g)}\ \ \ \ \Delta H_{\text{at}}^{\ominus}=+109\ \unit{kJ\ mol^{-1}}\\
\ce{\textstyle\frac{1}{2}H2(g) & ->[\Delta H_{\text{at}}^{\ominus}] H(g)}\ \ \ \ \Delta H_{at}^{\ominus}=+218\ \unit{kJ\ mol^{-1}}
\end{align*}
\end{tcolorbox}
\end{document}
关于如何删除多余的蓝色垂直空间,您有什么想法吗?
答案1
ams align*
使用tcolorbox 选项中的选项并避免使用ams align*
里面的环境。
\documentclass[12pt,x11names]{book}
\usepackage[T1]{fontenc}
\usepackage[version=4]{mhchem}
\usepackage{chemfig}
\usepackage{xcolor}
\definecolor{Powder blue}{HTML}{A8DADC}
\usepackage{garamondlibre}
\usepackage[most]{tcolorbox}
%geometry package
\usepackage{geometry}
\geometry{papersize={23cm,28cm}, right=9.3cm, left=3cm, top=2.5cm, bottom=3cm, marginparwidth=4.8cm, marginparsep=1.5cm, headheight=0cm}
\usepackage{siunitx}
\begin{document}
For example -
\begin{tcolorbox}[colback=Powder blue!50!white, colframe=Powder blue!50!white, ams align*]
%\begin{align*}
\ce{\textstyle\frac{1}{2}Br2(l) & ->[\Delta H_{at}^{\ominus}]Br(g)}\\
\ce{\textstyle\frac{1}{2}Cl2(g) & ->[\Delta H_{\text{at}}^{\ominus}] Cl(g)}\ \ \ \ \Delta H_{at}^{\ominus}=+121\ \unit{kJ\ mol^{-1}}\\
\ce{Na(s) & ->[\Delta H_{at}^{\ominus}] Na(g)}\ \ \ \ \Delta H_{\text{at}}^{\ominus}=+109\ \unit{kJ\ mol^{-1}}\\
\ce{\textstyle\frac{1}{2}H2(g) & ->[\Delta H_{\text{at}}^{\ominus}] H(g)}\ \ \ \ \Delta H_{at}^{\ominus}=+218\ \unit{kJ\ mol^{-1}}
%\end{align*}
\end{tcolorbox}
\end{document}
答案2
使用array
环境
\documentclass[12pt,x11names]{book}
\usepackage[T1]{fontenc}
\usepackage[version=4]{mhchem}
\usepackage{chemfig}
\usepackage{xcolor}
\definecolor{Powder blue}{HTML}{A8DADC}
\usepackage{garamondlibre}
\usepackage[most]{tcolorbox}
\usepackage{geometry}
\geometry{papersize={23cm,28cm}, right=9.3cm, left=3cm, top=2.5cm,
bottom=3cm, marginparwidth=4.8cm, marginparsep=1.5cm, headheight=0cm}
\usepackage{siunitx}
\begin{document}
\noindent
For example -
\begin{tcolorbox}[colback=Powder blue!50!white, colframe=Powder blue!50!white]
\arraycolsep=1.6pt
$\begin{array}{rl>{\qquad}l}
\ce{\textstyle\frac{1}{2}Br2(l) & ->[\Delta H_{at}^{\ominus}]Br(g)}\\
\ce{\textstyle\frac{1}{2}Cl2(g) & ->[\Delta H_{\text{at}}^{\ominus}] Cl(g)} & \Delta H_{at}^{\ominus}=+121\ \unit{kJ\ mol^{-1}}\\
\ce{Na(s) & ->[\Delta H_{at}^{\ominus}] Na(g)} & \Delta H_{\text{at}}^{\ominus}=+109\ \unit{kJ\ mol^{-1}}\\
\ce{\textstyle\frac{1}{2}H2(g) & ->[\Delta H_{\text{at}}^{\ominus}] H(g)} & \Delta H_{at}^{\ominus}=+218\ \unit{kJ\ mol^{-1}}
\end{array}$
\end{tcolorbox}
\end{document}