首頁>LaTeX>source

我正在使用 thmtools   我的檔案中的定理和定義.但是,我在努力尋找一些必要的選擇。

上圖顯示了我的問题。

  1. 如何删除第一行中的文字縮排 定理?
  2. 如何在定理之前和之後確保相同的垂直空間?

MwE如下:

\documentclass[a4paper,12pt]{book}
\usepackage[utf8]{inputenc}
\usepackage{graphicx}

\usepackage[T1]{fontenc}
\usepackage{amsthm}
\usepackage{thmtools}
\usepackage[framemethod=TikZ]{mdframed}
\usepackage{needspace}

\declaretheoremstyle[
numberwithin=chapter,
headfont=\normalfont\bfseries,
notefont=\normalfont\scshape, 
notebraces={$\lbrack$}{$\rbrack$},
postheadhook={\textcolor{gray!80}{\rule[.6ex]{\linewidth}{0.4pt}}\\},
bodyfont=\normalfont\itshape,
mdframed={
    backgroundcolor=gray!20, 
    linecolor=gray!20, 
    innertopmargin=6pt,
    innerbottommargin=6pt },
postheadspace=\newline
]{definition}
\declaretheorem[style=definition,name=Definition]{definition}
\AtBeginEnvironment{definition}{\Needspace{10\baselineskip}}
\begin{document}
\title{Simple Book Example}
\mainmatter
\chapter{The First Chapter}
Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Aenean commodo ligula eget dolor. Consectetuer adipiscing elit.
\begin{definition}[A Definition]
Aenean vulputate eleifend tellus. Aenean leo ligula, porttitor eu, consequat vitae, eleifend ac, enim. Aliquam lorem ante, dapibus in, viverra quis, feugiat a, tellus. Phasellus viverra nulla ut metus varius laoreet.
\end{definition}
Donec pede justo, fringilla vel, aliquet nec, vulputate eget, arcu. Lorem ipsum dolor sit amet, consectetuer adipiscing elit.
\end{document}
最新回復
  • 2019-12-5
    1 #

    嗯,這裏有一些修改来解決你的問题:

      How do I get rid of the text indent in the first line of the theorem?

    删除額外的 \\   在 postheadhook={<>}   键。

      How do I ensure the same vertical space before and after the theorem?

    有两个键, skipabove   和 skipbelow   你可以分別控製定理上下的空間。

    \documentclass[a4paper,12pt]{book}
    \usepackage[utf8]{inputenc}
    \usepackage{graphicx}
    \usepackage[T1]{fontenc}
    \usepackage{amsthm}
    \usepackage{thmtools}
    \usepackage[framemethod=TikZ]{mdframed}
    \usepackage{needspace}
    \declaretheoremstyle[
    numberwithin=chapter,
    headfont=\normalfont\bfseries,
    notefont=\normalfont\scshape, 
    notebraces={$\lbrack$}{$\rbrack$},
    postheadhook={\textcolor{gray!80}{\rule[.6ex]{\linewidth}{0.4pt}}}, % \\ removed
    bodyfont=\normalfont\itshape,
    mdframed={%
        backgroundcolor=gray!20, 
        linecolor=gray!20,
        splittopskip=20pt, 
        skipabove = 16pt, % to adjust the above skip
        innertopmargin=6pt,
        innerbottommargin=6pt},
    postheadspace=\newline
    ]{definition}
    \declaretheorem[style=definition,name=Definition]{definition}
    \AtBeginEnvironment{definition}{\Needspace{10\baselineskip}}
    \begin{document}
    \title{Simple Book Example}
    \mainmatter
    \chapter{The First Chapter}
    Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Aenean commodo ligula eget dolor. Consectetuer adipiscing elit.
    %
    \begin{definition}[A Definition]
    Aenean vulputate eleifend tellus. Aenean leo ligula, porttitor eu, consequat vitae, eleifend ac, enim. Aliquam lorem ante, dapibus in, viverra quis, feugiat a, tellus. Phasellus viverra nulla ut metus varius laoreet.
    \end{definition}
    %
    Donec pede justo, fringilla vel, aliquet nec, vulputate eget, arcu. Lorem ipsum dolor sit amet, consectetuer adipiscing elit.
    \end{document}
    

  • LaTeX amsthm:lyx中的\ swapnumbers
  • LaTeX enumerate:在環境之後和列舉之前留下空行