在newtheorem环境前面生成空白区

发布于 2025-05-18 23:52:40

大佬救命!

请问如何将这个例子前面产生空格,比如使得和第二个『对比』齐平呢?

image.png

\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}

查看更多

关注者
1
被浏览
143
1 个回答
Sagittarius Rover
我要成为Typst糕手/(ㄒoㄒ)/~~

maybe related: https://ask.latexstudio.net/ask/question/17595.html

  • 标签不要放一些诸如『大佬救命』的内容,适得其反...
  • 代码要用markdown语法,不然无法正确高亮
  • 可以关注一下\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}

image.png

撰写答案

请登录后再发布答案,点击登录

发布
问题

分享
好友

手机
浏览

扫码手机浏览