我在序言中有这样的代码:
\documentclass[12pt,letterpaper,twoside]{article}
\renewcommand*\rmdefault{cmd}
\usepackage{amsmath}
\usepackage{amssymb}
\usepackage{amsfonts}
\usepackage{animate}
\usepackage{anysize}
\usepackage{arcs}
\usepackage{array}
\usepackage[scale=0]{background}
\usepackage{calc}
\usepackage{cancel}
\usepackage{chngcntr}
\usepackage{CJK}
\usepackage{CJKspace}
\usepackage{CJKpunct}
\usepackage{colortbl}
\usepackage{enumitem}
\usepackage{epsfig}
\usepackage{epstopdf}
\usepackage{etoolbox}
\usepackage{fancybox}
\usepackage{fancyhdr}
\usepackage{float}
\usepackage{framed}
\usepackage{graphicx}
\usepackage{ifoddpage}
\usepackage{latexsym}
\usepackage{lmodern}
\usepackage{MnSymbol}
\usepackage{multicol}
\usepackage{multirow}
\usepackage{mwe}
\usepackage{pgffor}
\usepackage{rotating}
\usepackage{tabularx}
\usepackage{textcomp}
\usepackage{tgheros,tgtermes,tgcursor}
\usepackage{tikz}
\usepackage{times}
\usepackage{tipa}
\usepackage{varwidth}
\usepackage{wasysym}
\usepackage{wboiboites}
\usepackage[table, x11names]{xcolor}
\usepackage[T1]{fontenc}
\usepackage[spanish]{babel}
\usepackage[total={18.59cm,24.5cm},top=3cm,inner=1cm,outer=2cm]{geometry}
\usepackage[abs]{overpic}
\usepackage[breaklinks,colorlinks=true,linkcolor=red,citecolor=red, urlcolor=blue]{hyperref}
\usepackage[framemethod=TikZ]{mdframed}
\usepackage[breakable, theorems, skins]{tcolorbox,empheq}
\tcbuselibrary{skins,breakable,listings,theorems}
\newcolumntype{P}[1]{>{\centering\arraybackslash}p{#1}}
\newcolumntype{M}[1]{>{\centering\arraybackslash}m{#1}}
\tcbset{enhanced,fonttitle=\bfseries\large,fontupper=\normalsize\sffamily,
colback=hkvcyan,colframe=orange,colbacktitle=hkvred!10,
coltitle=black,center title
}
文档中的这段代码:
\newcolumntype{s}{>{\centering\arraybackslash}>{\hsize=.25\hsize}X}
\begin{center}
\begin{tcolorbox}[width=90mm,boxsep=1pt,,tabularx={c|c},title= {\textcolor{black}{ Expresiones trigonom\'etricas}}, beamer]
\centering
\textcolor{blue}{Expresi\'on} & \textcolor{blue}{Grado} \\ \hline\hline
$5m^{3}n^{4}$&$7$\\
\end{tcolorbox}
\end{center}
我需要每个单元格内的文本水平居中,但我的结果是这样的。
答案1
这是一个解决方案,只需重新定义X
列类型即可。我没有使用您的颜色(hkvcyan
,hkvred
),因为我不知道它们是什么,而且我不得不修剪您的代码,因为很多代码与您的问题无关。
\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage{fourier}
\usepackage{heuristica}
\usepackage{cabin}
\usepackage{colortbl}
\usepackage[breakable, theorems, skins]{tcolorbox}
\tcbset{enhanced,fonttitle=\bfseries\large,fontupper=\normalsize\sffamily,
colback=cyan,colframe=orange,colbacktitle=red!10,
coltitle=black,center title
}
\usepackage{tabularx}
\newcolumntype{s}{>{\centering\arraybackslash}>{\hsize=.25\hsize}X}
\newcolumntype{x}{>{\centering\arraybackslash}X}
\begin{document}
\begin{center}
\begin{tcolorbox}[width=90mm,boxsep=1pt,,tabularx={s|x},title= {\textcolor{black}{ Expresiones trigonométricas}},beamer]
\textcolor{blue}{Expresión} & \textcolor{blue}{Grado} \\ \hline\hline
$5m^{3}n^{4}$&$7$
\end{tcolorbox}
\end{center}
\end{document}