请问如何将这个例子前面产生空格,比如使得和第二个『对比』齐平呢?
\documentclass{ctexbook}
\usepackage{amsmath, amsthm, amssymb}
\usepackage{hyperref}
\newtheorem{example}{例}[section]
\begin{document}
1\\
对比
\hspace{1cm}对比
\begin{example}\label{example_3.2}
\textbf{椭球面:}$\frac{x^{2}}{a^{2}}+\frac{y^{2}}{b^{2}}+\frac{z^{2}}{c^{2}}=1$
\end{example}
\end{document}
maybe related: https://ask.latexstudio.net/ask/question/17595.html
\parindent
以及\indent
和\noindent
的作用,少用\\
如非必要,勿增实体。只用了amsthm
的功能实现...
\documentclass[12pt]{ctexbook}
\usepackage[showframe]{geometry}
\usepackage{amsmath,amsthm}
% \usepackage{hyperref}
\newtheoremstyle{qaqstyle}
{3pt} % Space above
{3pt} % Space below
{} % Body font
{1cm} % Indent amount(修改间距)
{\bfseries} % Theorem head font
{:} % Punctuation after theorem head(冒号)
{.5em} % Space after theorem head
{\thmname{#1}\thmnumber{ #2}.\thmnote{ #3}} % Theorem head spec (can be left empty, meaning `normal')
\theoremstyle{qaqstyle}%切换为新样式
\newtheorem{example}{例}[section]
\setlength{\parindent}{0pt}%取消段前缩进
\begin{document}
% 1\\%这一行的缩进是默认的\parindent
对比
\hspace{1cm}对比:你应该用theorem的title, 而不是自己手动输入『\texttt{\char92 textbf{椭球面:}}』
\begin{example}[椭球面]
$\frac{x^{2}}{a^{2}}+\frac{y^{2}}{b^{2}}+\frac{z^{2}}{c^{2}}=1$
\end{example}
\end{document}
明白了明白了,第一次提问不太熟练,多谢!