
¿Cómo expando el cuadro sobre ambas moléculas (centradas y en el espacio medio ajustable), pero los límites dentro del enumerate
entorno? La imagen es lo que quiero hacer. Intenté hacer lo siguiente, pero claramente no es lo suficientemente grande.
\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}
Respuesta1
No es exactamente una solución sino otro enfoque. Con tcolorbox puedes expandir el cuadro como desees.
\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}
Respuesta2
\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}
Editar para abordar la consulta OP en la sección de comentarios anterior
@jsbibra Lo siento, ¿cómo podría modificar el ancla tikz @{H} si la molécula no es lineal? Lo adjunté al MWE de arriba. – Dave2627
Elegir @H nuevamente como etiqueta confundiría a tikz ya que se usó en el primer ejemplo, simplemente use otro alfabeto como @XYZ como etiqueta y continúe.
\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}