
Como faço para expandir a caixa sobre ambas as moléculas (espaço centralizado e central ajustável), mas as bordas dentro do enumerate
ambiente? A imagem é o que eu quero fazer. Tentei fazer o seguinte, mas claramente não é grande o suficiente.
\documentclass{article}
\usepackage{chemfig,chemmacros}
\chemsetup{modules=all}
\usepackage[version=4,arrows=pgf]{mhchem}
\usepackage{amsmath}
\usepackage{tabu}
\usepackage{framed}
\definecolor{SolutionColor}{gray}{0.85}
\usepackage{linegoal}
\newcommand{\mybox}[1]{\colorbox{SolutionColor}{\parbox[t]{\linegoal}{#1}}}
\begin{document}
\begin{enumerate}
\item Are the compounds shown below isomers?
\begin{center}
\mybox{
{\tabulinesep=1.6mm
\begin{tabu}{cc}
\chemfig[double bond sep=0.3em,atom sep=2.5em]{H-C(-[2]H)(-[6]H)-C(-[2]H)(-[6]H)-C(-[2]OH)(-[6]H)-C(-[2]H)(-[6]H)-H} & \chemfig[double bond sep=0.3em,atom sep=2.5em]{H-C(-[2]H)(-[6]H)-C(-[2]H)(-[6]H)-C(-[2]H)(-[6]H)-C(-[2]OH)(-[6]H)-H}
\end{tabu}}
}
\end{center}
Yes or No
Why?
\item Are the following geometric isomers?
\begin{center}
\chemfig[double bond sep=0.3em,atom sep=2.5em]{H_3C-[:-60,,2]C(-[:-120]H)=C(-[:-60]CH_3)-[:60]H}
\hspace{1em}
\chemfig{@{H}}
\hspace{1em}
\chemfig[double bond sep=0.3em,atom sep=2.5em]{H_3C-[:-60,,2]C(-[:-120]H_3C)=C(-[:-60]H)-[:60]H}
\end{center}
\begin{tikzpicture}[remember picture, overlay]
\draw[fill=gray,opacity=0.4]($(H.north east)+(6cm,1cm)$)rectangle($(H.south west)+(-5cm,-1cm)$);
\end{tikzpicture}
\end{enumerate}
\end{document}
Responder1
Não é exatamente uma solução, mas outra abordagem. Com tcolorbox você pode expandir a caixa como desejar.
\documentclass{article}
\usepackage{chemfig}
\usepackage{tcolorbox}
\definecolor{SolutionColor}{gray}{0.85}
\begin{document}
\begin{enumerate}
\item Are the compounds shown below isomers?
\begin{tcolorbox}[colback=SolutionColor, sharp corners, boxrule=0pt, left=2mm, right=2mm, top=4mm, bottom=1cm]
\centering
\setchemfig{double bond sep=0.3em,atom sep=2.5em}
\chemfig{H-C(-[2]H)(-[6]H)-C(-[2]H)(-[6]H)-C(-[2]OH)(-[6]H)-C(-[2]H)(-[6]H)-H}
\hspace{5mm}
\chemfig{H-C(-[2]H)(-[6]H)-C(-[2]H)(-[6]H)-C(-[2]H)(-[6]H)-C(-[2]OH)(-[6]H)-H}
\end{tcolorbox}
Yes or No
Why?
\end{enumerate}
\end{document}
Responder2
\documentclass{article}
\usepackage{chemfig,chemmacros}
\chemsetup{modules=all}
\usepackage[version=4,arrows=pgf]{mhchem}
\usepackage{amsmath}
\usepackage{tabu}
\usepackage{framed}
\definecolor{SolutionColor}{gray}{0.85}
\usepackage{linegoal}
\newcommand{\mybox}[1]{\colorbox{SolutionColor}{\parbox[t]{\linegoal}{#1}}}
\usepackage{tikz}
\usetikzlibrary{calc}
\begin{document}
\begin{enumerate}
\item Are the compounds shown below isomers?\\
\begin{center}
\chemfig[
double bond sep=0.3em,
atom sep=2.5em
]
{H-C(-[2]H)(-[6]H)-C(-[2]H)(-[6]H)-C(-[2]OH)(-[6]H)-C(-[2]H)(-[6]H)-@{H}H}
\qquad
\chemfig[
double bond sep=0.3em,
atom sep=2.5em
]
{H-C(-[2]H)(-[6]H)-C(-[2]H)(-[6]H)-C(-[2]H)(-[6]H)-C(-[2]OH)(-[6]H)-H}
\end{center}
Yes or No
\\
Why?
\end{enumerate}
\begin{tikzpicture}[remember picture, overlay]
\draw[red,fill=gray,opacity=0.5]($(H.north east)+(6cm,1cm)$)rectangle($(H.south
west)+(-5cm,-1cm)$);
\end{tikzpicture}
\end{document}
Edite para abordar a consulta do OP na seção de comentários acima
@jsbibra Desculpe, como posso modificar a âncora tikz @{H} se a molécula não é linear? Anexei-o ao MWE acima. -Dave2627
Escolher @H novamente como uma tag pode confundir o tikz, já que foi usado no primeiro exemplo, basta usar outro alfabeto como @XYZ como uma tag e seguir em frente
\documentclass{article}
\usepackage{chemfig,chemmacros}
\chemsetup{modules=all}
\usepackage[version=4,arrows=pgf]{mhchem}
\usepackage{amsmath}
\usepackage{tabu}
\usepackage{framed}
\definecolor{SolutionColor}{gray}{0.85}
\usepackage{linegoal}
\newcommand{\mybox}[1]{\colorbox{SolutionColor}{\parbox[t]{\linegoal}{#1}}}
\usepackage{tikz}
\usetikzlibrary{calc}
\begin{document}
\begin{enumerate}
\item Are the compounds shown below isomers?\\
\begin{center}
\chemfig[
double bond sep=0.3em,
atom sep=2.5em
]
{H-C(-[2]H)(-[6]H)-C(-[2]H)(-[6]H)-C(-[2]OH)(-[6]H)-C(-[2]H)(-[6]H)-@{H}H}
\qquad
\chemfig[
double bond sep=0.3em,
atom sep=2.5em
]
{H-C(-[2]H)(-[6]H)-C(-[2]H)(-[6]H)-C(-[2]H)(-[6]H)-C(-[2]OH)(-[6]H)-H}
\end{center}
Yes or No
\\
Why?
\\
\item Are the following geometric isomers?
\begin{center}
\chemfig[double bond sep=0.3em,atom sep=2.5em]{H_3C-[:-60,,2]C(-[:-120]H)=C(-[:-60]CH_3)-[:60]@{X}H}
\hspace{1em}
% \chemfig{@{H}}
\hspace{1em}
\chemfig[double bond sep=0.3em,atom sep=2.5em]{H_3C-[:-60,,2]C(-[:-120]H_3C)=C(-[:-60]H)-[:60]H}
\end{center}
\end{enumerate}
\begin{tikzpicture}[remember picture, overlay]
\draw[red,fill=gray,opacity=0.5]($(H.north east)+(6cm,1cm)$)rectangle($(H.south
west)+(-5cm,-1cm)$);
\draw[blue,line width=2pt,fill=teal,opacity=0.3]($(X.north east)+(5cm,4pt)$)rectangle($(X.south
west)+(-3cm,-5em)$);
\end{tikzpicture}
\end{document}