我尝试使用 \hat 总是能很好地工作,但在这个等式中它没有居中并且看起来很糟糕
\documentclass [12pt]{article}
\usepackage{float}
\usepackage{authblk}
\usepackage{etoolbox}
\usepackage{lmodern}
\usepackage{amsmath}
\usepackage{graphicx}
\usepackage{subcaption}
\usepackage{tabularx}
\usepackage[numbers]{natbib}
\usepackage[utf8]{inputenc}
\usepackage[english]{babel}
\usepackage{caption}
\usepackage{amssymb}
\usepackage{graphicx,epstopdf}
\usepackage{caption}
\usepackage{graphicx,kantlipsum,setspace}
\usepackage{mathptmx}
\usepackage{pgfplots}
\captionsetup{font={stretch=1.0}} %% this affects both figure and table
\setstretch{1.0}
\captionsetup[figure]{font=small,labelfont=bf}
\usepackage[left=6cm,top=3cm,right=2cm,bottom=3cm]{geometry}
\usepackage{lipsum}
\usepackage{setspace}
\usepackage[export]{adjustbox}
\renewcommand{\baselinestretch}{1.5}
\newcommand\seqwlimits[3]{\{#1\}_{\mathstrut#2}^{\mathstrut#3}}
\begin{document}
\maketitle
\renewcommand{\baselinestretch}{1.5}
\thispagestyle{empty}
\begin{equation}
Q_{Ind}(\pi_{01} = \pi_{11}) = -2\log\left(\frac{(1-\hat{\pi_1})^{T_{00}} \hat{\pi_1}^{T_{01}} (1-\hat{\pi_1})^{T_{10}} \hat{\pi_1}^{T_{11}} }{(1-\hat{\pi_01})^{T_{00}} \hat{\pi_{01}}^{T_{01}} (1-\hat{\pi_{11}})^{T_{10}} \hat{\pi_{11}}^{T_{11}}}\right)
\end{equation}
\end {document}
答案1
我假设您希望将帽子符号置于上方\pi
而不是上方。\pi_1
如果此假设正确,只需更改代码,使的参数中只有。\pi_{01}
\pi_{11}
\pi
\hat
一些额外的评论:(i)不要多次加载包。(ii)由于您正在加载包setspace
,运行不是一个好主意\renewcommand{\baselinestretch}{1.5}
;而是运行\setstretch{1.5}
。(iii)如果您稍后要加载 Times Roman 文本和数学字体,那么加载字体包是没有意义的lmodern
。(iv)除非您的 TeX 发行版非常古老,否则没有必要加载包epstopdf
。(v)可选:为确保下面的下标\hat{\pi}
都在基线以下的相同深度排版,请将^{}
项目添加到那些\hat{\pi}
尚无上标项的实例中。
\documentclass[12pt]{article}
% (simplified the preamble to load only essential packages)
\usepackage[english]{babel}
\usepackage[utf8]{inputenc}
\usepackage[left=6cm,right=2cm,vmargin=3cm]{geometry}
\usepackage[nodisplayskipstretch]{setspace}
\setstretch{1.5} % NOT "\renewcommand{\baselinestretch}{1.5}"
\usepackage{amsmath}
% 'mathptmx' is borderline obsolete
\usepackage{newtxtext,newtxmath}
\begin{document}
\[
Q_{\mathrm{Ind}}( \pi_{01}=\pi_{11} ) =
-2\log \Biggl[ \frac{%
(1-\hat{\pi}^{}_1)^{T_{00}} \hat{\pi}_1^{T_{01}}
(1-\hat{\pi}^{}_1)^{T_{10}} \hat{\pi}_1^{T_{11}}}%
{(1-\hat{\pi}^{}_{01})^{T_{00}} \hat{\pi}_{01}^{T_{01}}
(1-\hat{\pi}^{}_{11})^{T_{10}} \hat{\pi}_{11}^{T_{11}}
} \Biggr]
\]
\end{document}