如何在公式中保留空格

如何在公式中保留空格

我想要這個公式中的變數之間有一個空格(一元一階時序邏輯)。我嘗試使用\,and\hspace{}但兩者似乎都不起作用。有人可以幫我嗎?範例公式:

$G(\forall  (x) \forall (y)(p(x) \vee \neg p(y)))$

它應該是

G space(\forall  (x)space \forall (y)space(p(x)space \vee space \neg p(y)))

答案1

那裡一個區別。以下是公式的 5 個版本,具有正常間距,並添加\,\:\;\在我看來,唯一可以證明添加一些空格的地方就是量詞之間。對於括號和二進位符號,間距很好:

\documentclass{article}
\usepackage{mathtools} %

\begin{document}
\begin{gather*}
  G\Bigl(\forall (x)\forall (y)\bigl(p(x) \vee\neg p(y)\bigr)\Bigr)\\
  G\,\Bigl(\forall (x)\,\forall (y)\,\bigl(p(x)\,\vee\,\neg p(y)\bigr)\Bigr)\\
  G\:\Bigl(\forall (x)\: \forall (y)\: \bigl(p(x)\: \vee\:\neg p(y)\bigr)\Bigr)\\
  G\;\Bigl(\forall (x)\;\forall (y)\;\bigl(p(x)\;\vee\;\neg p(y)\bigr)\Bigr)\\
  G\ \Bigl(\forall (x)\ \forall (y)\ \bigl(p(x)\ \vee\ \neg p(y)\bigr)\Bigr)\\
\end{gather*}

\end{document} 

在此輸入影像描述

答案2

這裡看不出有什麼問題。這些都不適合你嗎?只是為了舉一些例子。你可以找到一個大名單這裡

% arara: pdflatex

\documentclass{article}
\usepackage{mathtools}
\newcommand*{\test}[1]{$G#1(\forall(x)#1\forall(y)#1(p(x)#1\vee#1\neg{}p(y)))$\par}

\begin{document}
\test{}
\test{\,}
\test{\>}
\test{\ }
\test{\mkern+10mu}
\test{\quad}
\test{\qquad}
\test{\hskip 3em}
\test{\hspace{35pt}}
\end{document}

在此輸入影像描述

當然,您可以直接在公式中新增這些命令,並在每一行中使用不同的命令。

相關內容