# 【LaTex、markdown】常用语法写出漂亮的blog

@[TOC](https://github.com/UnderTurrets/notes/blob/master/uncategorized/文章目录/README.md)

***

## markdown

### 加粗

```txt
**加粗样式**
```

* 格式：两边加两个`*`

效果如下：**加粗样式**

### 斜体

```txt
*斜体样式*
```

* 格式：两边加一个`*`

效果如下：*斜体样式*

### 设置标题级别

```txt
# 标题
```

* 格式：一级标题就一个`#`，二级标题就两个`#`，最多六级标题

效果如标题

### 设置目录

```txt
@[TOC](这里写目录标题)
```

* 格式：`@[TOC](这里写目录标题)`

效果如本文目录

### 删除线

```txt
~~删除线格式~~ 
```

* 格式：两边加两个`~`

效果如下：~~删除线格式~~

### 无序列表

```txt
- 内容1
- 内容2
```

* 格式：内容前面加`-`

效果如下：

* 内容1
* 内容2

### 有序列表

```txt
1. 内容1
2. 内容2
```

* 格式：内容前面加`1.` 或者`2.` 即可

效果如下：

1. 内容1
2. 内容2

### 分割线

```txt
---
```

* 格式：三个`-`

效果如下：

***

### 代办

```txt
 - [ ] List item
```

* 格式：事项前面加`- [ ]`

效果如下：

* [ ] List item

### 引用

```txt
> 这里是引用
```

* 格式：内容前面加`>`

效果如下：

> 这里是引用

### 高亮

```txt
==标记文本==
```

* 格式：两边加两个`=`

效果如下：==高亮文本==

### 标记

```txt
`标记文本`
```

* 格式：两边加一个 \`

效果如下：`标记文本`

### 字体颜色

```txt
<font color=red>红色</font>
```

```txt
<font color=red>
红色
</font>
```

* 格式：使用HTML语法

效果如下：红色

以下是一些常用颜色：

| 语法示例                             | 颜色效果 |
| -------------------------------- | ---- |
| `<font color=red>红色</font>`      | 红色   |
| `<font color=orange>橙色</font>`   | 橙色   |
| `<font color=green>绿色</font>`    | 绿色   |
| `<font color=cyan>青色</font>`     | 青色   |
| `<font color=blue>蓝色</font>`     | 蓝色   |
| `<font color=violet>紫罗兰色</font>` | 紫罗兰色 |

### 代码块

````txt


```javascript
var foo = 'bar';
````

````

- 格式：在代码的上下两行添加三个`，后面可以加语言类型，如cpp， javascript。

效果：

```javascript
var foo = 'bar';
````

### 图片

```txt
![](https://cdn.jsdelivr.net/gh/UnderTurrets/ImageHosting@master/image_summaryDemo.png)
```

* 格式：`![图片描述](图片路径)`

效果如下：

![](https://cdn.jsdelivr.net/gh/UnderTurrets/ImageHosting@master/image_summaryDemo.png)

### 链接

```txt
链接: [link](https://www.csdn.net/)
```

* 格式：`[链接描述](链接路径)`

效果如下：[link](https://www.csdn.net/)

### 表格

```txt
| Column 1 | Column 2 |Column 3 |
|:--:| ---:| :--|
| 文本居中 | 文本居右 | 文本居左  |
```

* 格式：第一行表头，第二行的冒号决定文本居中、居左、居右，默认居中

效果如下：

| Column 1 | Column 2 | Column 3 |
| :------: | -------: | -------- |
|   文本居中   |     文本居右 | 文本居左     |

### 公式表达

markdown中的公式表达方法与LaTex是完全一致的。这里我提供一个可以在线生成公式的[网站](https://www.latexlive.com/)，其中涵盖了大多数的公式表达方法，本文不再赘述。

### 行中公式

```txt
$y_{max}=\max\left \{     y_{1},y_{2},...,y_{n}        \right \}$
```

* 格式：表达式两边加一个`$`

效果如下：$y\_{max}=\max\left { y\_{1},y\_{2},...,y\_{n} \right }$

### 独行公式

```txt
$$
y_{max}=\max\left \{     y_{1},y_{2},...,y_{n}        \right \}
$$
```

* 格式：表达式上下两行加两个`$`

效果如下：

$$
y\_{max}=\max  \left {     y\_{1},y\_{2},...,y\_{n}        \right }
$$

## LaTex初步

### 文章骨干

```txt
%所撰写文本的类型
\documentclass{article}

%要使用的一些包
\usepackage{graphicx} % Required for inserting images
\usepackage{xeCJK}

%标题，作者，日期
\title{标题}
\author{Your name}
\date{today}

%文本开始
\begin{document}

%表示标题独占一页
\begin{titlepage}
\maketitle
\end{titlepage}

%摘要部分
\begin{abstract}
  
\end{abstract}

%正文部分
%设置标题级别
\section{一级标题}

\subsection{二级标题}

\subsubsection{三级标题}

%引用文献
\bibliographystyle{}
\bibliography{}

%文本结束
\end{document}
```

### 换行与换页

```txt
\section{换行教学}
第一行

第二行

\section{换页教学}
第一页

\newpage 

第二页
```

* 换行需要空一行
* 换页用`\newpage`

### figure（基本是图片）

```txt
\begin{figure}[htbp]
    \centering
    \includegraphics[width=0.5\textwidth,height=0.61\textwidth]{you_image.jpg}
    \caption{填入的图题}
    \label{fig:enter-label}
\end{figure}

\begin{figure}[htbp]
    \centering
    \includegraphics[width=5cm,height=5cm]{you_image.jpg}
    \caption{填入的图题}
    \label{fig:enter-label}
\end{figure}
```

* `\centering`表示居中
* `\includegraphics`指定图片样式和路径
* `\caption`表示图题
* `\label`表示你给它取的名字，以后引用时会用到

### 表格

```txt
\begin{table}[]
    \centering
    \begin{tabular}{c|c}
         &  \\
         & 
    \end{tabular}
    \caption{Caption}
    \label{tab:my_label}
\end{table}
```

表格可以利用一些网站在线生成，不用死记。

### 公式

```txt
\begin{equation}
  
\end{equation}
```

公式可以利用一些网站在线生成，不用死记。

### 公式字体颜色

```txt
\textcolor{red}{ y_{max} } =\max \left \{    y_{\textcolor{blue}{ 1}},y_{2},...,y_{n}      \right \}
```

* 格式：使用`\textcolor`关键字

效果如下：

$$
\textcolor{red}{ y\_{max} } =\max \left {  y\_{\textcolor{violet}{1}},y\_{2},...,y\_{n}     \right }
$$

以下是一些常用颜色：

| 语法示例                   | 颜色效果                       |
| ---------------------- | -------------------------- |
| \textcolor{red}{红色}    | $$\textcolor{red}{红色}$$    |
| \textcolor{orange}{橙色} | $$\textcolor{orange}{橙色}$$ |
| \textcolor{green}{绿色}  | $$\textcolor{green}{绿色}$$  |
| \textcolor{cyan}{青色}   | $$\textcolor{cyan}{青色}$$   |
| \textcolor{blue}{蓝色}   | $$\textcolor{blue}{蓝色}$$   |
| \textcolor{violet}{紫色} | $$\textcolor{violet}{紫色}$$ |

### 左右居中

```txt
%居中
\begin{center}
  
\end{center}

%居左
\begin{flushleft}
  
\end{flushleft}

%居右
\begin{flushright}
  
\end{flushright}
```

### figure引用

在figure的定义中，我们已经给figure取了一个名字，用`\label`取名。接下来，在正文部分进行引用，只需要如下做：

```txt
\ref{figure_name}
```

* `figure_name`是你给figure起的名字

### 文献引用

首先，在骨干中，会有如下两行表示引用

```txt
%引用文献
\bibliographystyle{}
\bibliography{}
```

* `\bibliographystyle`表示bib文件的格式
* `\bibliography`表示bib文件的路径

在正文部分进行引用时，只需要如下做：

```txt
\cite{paper_name}
```

* `paper_name`是在bib文件中所引文献的名字


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://hanxu.gitbook.io/blogs/uncategorized/latexmarkdown-chang-yong-yu-fa-xie-chu-piao-liang-de-blog.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
