
Estoy tratando de poner dos instancias tcolorbox
una al lado de la otra y alinearlas verticalmente con la parte superior. En otras publicaciones he probado minipage
la opción [t]
con este código.
\begin{document}
\begin{minipage}[t]{0.5\textwidth}
\begin{tcolorbox}[colback=isabelline,colframe=antiquewhite!20!black,title=Boundary layer]
\footnotesize{0, no boundary-layer\\
1, YSU scheme\\
2, Mellor-Yamada-Janjic TKE\\
3, NCEP Global Forecast System}
\end{tcolorbox}
\end{minipage}
\begin{minipage}[t]{0.5\textwidth}
\begin{tcolorbox}[colback=isabelline,colframe=antiquewhite!20!black,title=Surface physics]
\footnotesize{0, no surface temp prediction\\
1, thermal diffusion scheme\\
2, Unified Noah land-surface model\\
1, thermal diffusion scheme\\
2, Unified Noah land-surface model\\
1, thermal diffusion scheme\\
2, Unified Noah land-surface model\\
3, RUC land-surface model}
\end{tcolorbox}
\end{minipage}
\end{document}
Pero el resultado es que están alineados hacia abajo. ¿Qué me estoy perdiendo?
Gracias
Respuesta1
Consulte la actualización especial tcolorbox
para dichos entornos al final de la respuesta.
Úselo tcbraster
para alinear la caja; esto proporciona una interfaz mucho más limpia para muchas configuraciones con tcolorbox
.
digamos \begin{tcbraster}[raster columns=2,box valign=top]...\end{tcbraster}
por ejemplo
Tenga en cuenta que solo tcolorbox
los entornos pueden aparecer en un ráster.
\documentclass{article}
\usepackage[x11names,svgnames,dvipsnames]{xcolor}
\usepackage[most]{tcolorbox}
\begin{document}
\begin{tcbraster}[raster columns=2, raster valign=top]
\begin{tcolorbox}[colback=white!70!yellow,colframe=white!20!black,title=Boundary layer]
\footnotesize 0, no boundary-layer
1, YSU scheme
2, Mellor-Yamada-Janjic TKE
3, NCEP Global Forecast System
\end{tcolorbox}
\begin{tcolorbox}[colback=white!70!yellow,colframe=white!20!black,title=Surface physics]
\footnotesize 0, no surface temp prediction
1, thermal diffusion scheme
2, Unified Noah land-surface model
1, thermal diffusion scheme
2, Unified Noah land-surface model
1, thermal diffusion scheme
2, Unified Noah land-surface model
3, RUC land-surface model
\end{tcolorbox}
\end{tcbraster}
\end{document}
Actualizarcon especial tcolorbox
para esto.
\documentclass{article}
\usepackage[x11names,svgnames,dvipsnames]{xcolor}
\usepackage[most]{tcolorbox}
\newtcolorbox{somebox}[1][]{%
colback=white!70!yellow,
colframe=white!20!black,
#1%
}
\begin{document}
\begin{tcbraster}[raster columns=2, raster valign=top,fontupper=\footnotesize]
\begin{somebox}[title=Boundary layer]
0, no boundary-layer
1, YSU scheme
2, Mellor-Yamada-Janjic TKE
3, NCEP Global Forecast System
\end{somebox}
\begin{somebox}[title=Surface physics]
0, no surface temp prediction
1, thermal diffusion scheme
2, Unified Noah land-surface model
1, thermal diffusion scheme
2, Unified Noah land-surface model
1, thermal diffusion scheme
2, Unified Noah land-surface model
3, RUC land-surface model
\end{somebox}
\end{tcbraster}
\end{document}
Respuesta2
Aquí, utilicé la \belowbaseline
función de stackengine
para colocar cada minipage
valor de -\ht\strutbox
debajo de la línea base, de modo que actúe como un [t]
cuadro alineado. Agregué, como prueba, el texto "Ver línea de base" antes del primer cuadro, para discernir la alineación representada.
\documentclass{article}
\usepackage{tcolorbox,xcolor,stackengine}
\begin{document}
See baseline\belowbaseline[-\ht\strutbox]{\begin{minipage}{0.5\textwidth}
\begin{tcolorbox}[colback=red!3,colframe=yellow!20!black,title=Boundary layer]
\footnotesize{0, no boundary-layer\\
1, YSU scheme\\
2, Mellor-Yamada-Janjic TKE\\
3, NCEP Global Forecast System}
\end{tcolorbox}
\end{minipage}}
\belowbaseline[-\ht\strutbox]{\begin{minipage}{0.5\textwidth}
\begin{tcolorbox}[colback=red!3,colframe=yellow!20!black,title=Surface physics]
\footnotesize{0, no surface temp prediction\\
1, thermal diffusion scheme\\
2, Unified Noah land-surface model\\
1, thermal diffusion scheme\\
2, Unified Noah land-surface model\\
1, thermal diffusion scheme\\
2, Unified Noah land-surface model\\
3, RUC land-surface model}
\end{tcolorbox}
\end{minipage}}
\end{document}