메인 컨텐츠로 이동
Version: 2.0.0-beta.4

수식

KaTeX를 사용해 수식을 작성할 수 있습니다.

사용법#

자세한 내용은 KaTeX 문서를 참고하세요.

인라인#

$ 기호 사이에 LaTex 문법에 따라 수식을 입력하면 인라인 수식을 작성할 수 있습니다.

Let $f:[a,b] \to \R$ be Riemann integrable. Let $F:[a,b]\to\R$ be $F(x)=\int_{a}^{x}f(t)dt$. Then $$F$$ is continuous, and at all $x$ such that $f$ is continuous at $x$, $F$ is differentiable at $x$ with $F'(x)=f(x)$.

Let f:[a,b]Rf:[a,b] \to \R be Riemann integrable. Let F:[a,b]RF:[a,b]\to\R be F(x)=axf(t)dtF(x)= \int_{a}^{x}f(t)dt. Then FF is continuous, and at all xx such that ff is continuous at xx, FF is differentiable at xx with F(x)=f(x)F'(x)=f(x).

블록#

수식 블록 또는 디스플레이 모드는 $$기호와 줄바꿈을 사용합니다.

$$I = \int_0^{2\pi} \sin(x) dx$$

$$ I = \int_0^{2\pi} \sin(x) dx $$

설정#

KaTex를 사용하기 위해서는 먼저 remark-mathrehype-katex 플러그인을 설치해야 합니다.

npm install --save remark-math@3 rehype-katex@4 hast-util-is-element@1.1.0
caution

정확하게 위에 기재한 버전과 같은 버전을 사용하세요. 최신 버전은 도큐사우루스 2와 호환되지 않을 수 있습니다.

플러그인 항목을 docusaurus.config.js 파일에 추가 설정합니다.

const math = require('remark-math');const katex = require('rehype-katex');

여러분의 콘텐츠 플러그인 또는 프리셋 옵션에 추가합니다(일반적인 경우 @docusaurus/preset-classic 문서 옵션).

remarkPlugins: [math],rehypePlugins: [katex],

KaTex CSS를 설정에 stylesheets로 추가합니다.

stylesheets: [    {        href: "https://cdn.jsdelivr.net/npm/katex@0.13.11/dist/katex.min.css",        integrity: "sha384-Um5gpz1odJg5Z4HAmzPtgZKdTBHZdw8S29IecapCSB31ligYPhHQZMIlWLYQGVoc",        crossorigin: "anonymous",    },],

추가된 설정은 아래와 같은 형태가 됩니다.

docusaurus.config.js
const math = require('remark-math');const katex = require('rehype-katex');
module.exports = {  title: 'Docusaurus',  tagline: 'Build optimized websites quickly, focus on your content',  presets: [    [      '@docusaurus/preset-classic',      {        docs: {          path: 'docs',          remarkPlugins: [math],          rehypePlugins: [katex],        },      },    ],  ],  stylesheets: [    {      href: 'https://cdn.jsdelivr.net/npm/katex@0.13.11/dist/katex.min.css',      integrity:        'sha384-Um5gpz1odJg5Z4HAmzPtgZKdTBHZdw8S29IecapCSB31ligYPhHQZMIlWLYQGVoc',      crossorigin: 'anonymous',    },  ],};