Overleaf使用教程

Overleaf使用教程

文档 - Overleaf, 在线LaTeX编辑器

Create LaTeX tables online – TablesGenerator.com 创建表格

Learn LaTeX in 30 minutes

\documentclass[12pt, letterpaper]{article}			
% 声明文档类型,不同类型的文档需要不同的类,12pt设置字体大小,letterpaper设置纸张大小
% 序言部分
% 定义文档类型,加载包
% \usepackage[options]{somepackage}
\usepackage{graphicx} % graphicx包提供导入图片功能
\graphicspath{{images/}} % 图片保存在名为images的文件夹中,该文件夹包含在当前目录中

\title{My first LaTeX document}
\author{Hubert Farnsworth\thanks{Funded by the Overleaf team.}}		% \thanks致谢机构
\date{August 2022}			% 可以手动键入日期,也可以 \date{\today}

\begin{document}
\maketitle		%排版标题、作者和日期

\tableofcontents	% 生成目录

\begin{abstract}
This is a simple paragraph at the beginning of the 
document. A brief introduction about the main subject.
\end{abstract}
% 摘要

First document. This is a simple example, with no extra parameters or packages included.

Some of the \textbf{greatest}					% \textbf{...} 粗体
discoveries in \underline{science} 				% \underline{...} 下划线
were made by \textbf{\textit{accident}}.		% \textit{...} 斜体 可以嵌套使用
% \emph{argument} 也是强调的命令

\includegraphics{universe} 			% 导入图片,只需要文件名不需要拓展名

\begin{figure}[h]
    \centering
    \includegraphics[width=0.75\textwidth]{mesh}	% 将图形的宽度设置为文本宽度的75%,mesh为文件名
    \caption{A nice plot.}		% 设置图形标题,可以放在图形的上方或下方
    \label{fig:mesh1}		% 要在文档中引用此图像,可以使用\label命令为其添加标签,该标签用于为图像生成一个数字
\end{figure}
 
As you can see in figure \ref{fig:mesh1}, the function grows near the origin. This example is on page \pageref{fig:mesh1}.		% \ref{fig:mesh1}:此代码将替换为与参考图形对应的数字

\begin{itemize}
  \item The individual entries are indicated with a black dot, a so-called bullet.
  \item The text in the entries may be of any length.
\end{itemize}
% 生成分点的无序列表

\begin{enumerate}
  \item This is the first entry in our list.
  \item The list numbers increase with each entry we add.
\end{enumerate}
% 生成分点的有序列表,序号从1开始

In physics, the mass-energy equivalence is stated 
by the equation $E=mc^2$, discovered in 1905 by Albert Einstein.
% 行内公式 \( ... \)  $ ... $   \begin{math} ... \end{math} 三种方式

The mass-energy equivalence is described by the famous equation
\[ E=mc^2 \] discovered in 1905 by Albert Einstein. 		
% 无编号的行间数学公式
% \[ ... \] \begin{displaymath} ... \end{displaymath} \begin{equation} ... \end{equation}

In natural units ($c = 1$), the formula expresses the identity
\begin{equation}
E=m
\end{equation}
% 有编号的行间数学公式

% 按两次enter键,结束当前行并插入后续空行来创建新段落
% 在不开始新段落的情况下开始新行,使用 \\ 命令插入手动换行符,或者使用 \newline 命令
\end{document}

\documentclass{book}		% 加在开头
\chapter{First Chapter}		% 创建新的章节

\section{Introduction}		% 自动编号 1.1

This is the first section.

Lorem  ipsum  dolor  sit  amet,  consectetuer  adipiscing  
elit. Etiam  lobortisfacilisis sem.  Nullam nec mi et 
neque pharetra sollicitudin.  Praesent imperdietmi nec ante. 
Donec ullamcorper, felis non sodales...

\section{Second Section}	% 1.2

Lorem ipsum dolor sit amet, consectetuer adipiscing elit.  
Etiam lobortis facilisissem.  Nullam nec mi et neque pharetra 
sollicitudin.  Praesent imperdiet mi necante...

\subsection{First Subsection}		% 1.2.1
Praesent imperdietmi nec ante. Donec ullamcorper, felis non sodales...

\section*{Unnumbered Section}		% 通过带*来禁用编号功能
Lorem ipsum dolor sit amet, consectetuer adipiscing elit.  
Etiam lobortis facilisissem...

% \part{part}
% \chapter{chapter}
% \section{section}
% \subsection{subsection}
% \subsubsection{subsubsection}
% \paragraph{paragraph}
% \subparagraph{subparagraph}


% 创建表格
\begin{center}
\begin{tabular}{c c c}	
% 为该环境指定参数,在本例中为{c c c},将有三列并且每一列中的文本必须居中,r将文本右对齐,l将其左对齐
 cell1 & cell2 & cell3 \\ 		% 对齐符号 & 用于划分表格行中的各个表格单元格
 cell4 & cell5 & cell6 \\  		% 结束表格行,使用换行命令 \\
 cell7 & cell8 & cell9    
\end{tabular}
\end{center}			% 包含在 center 环境中,使其在页面的文本宽度内居中

% 添加边框
\begin{center}
\begin{tabular}{|c|c|c|} 	
% 要在列之间添加垂直规则,使用垂直线参数 |,参数是 {|c|c|c|},它声明了三个(居中)列,每个列由垂直线(规则)分隔
 \hline				% 行的上方和下方添加水平线,使用 \hline 命令,这里在第一行上方和最后一行下方放置一条水平线:
 cell1 & cell2 & cell3 \\ 
 cell4 & cell5 & cell6 \\ 
 cell7 & cell8 & cell9 \\ 
 \hline
\end{tabular}
\end{center}

\begin{center}
 \begin{tabular}{||c c c c||} 
 \hline
 Col1 & Col2 & Col2 & Col3 \\ [0.5ex] 
 \hline\hline
 1 & 6 & 87837 & 787 \\ 
 \hline
 2 & 7 & 78 & 5415 \\
 \hline
 3 & 545 & 778 & 7507 \\
 \hline
 4 & 545 & 18744 & 7560 \\
 \hline
 5 & 88 & 788 & 6344 \\ [1ex] 
 \hline
\end{tabular}
\end{center}

Table \ref{table:data} shows how to add a table caption and reference a table.		% 引用标签
\begin{table}[h!]
\centering
\begin{tabular}{||c c c c||} 
 \hline
 Col1 & Col2 & Col2 & Col3 \\ [0.5ex] 
 \hline\hline
 1 & 6 & 87837 & 787 \\ 
 2 & 7 & 78 & 5415 \\
 3 & 545 & 778 & 7507 \\
 4 & 545 & 18744 & 7560 \\
 5 & 88 & 788 & 6344 \\ [1ex] 
 \hline
\end{tabular}
\caption{Table to test captions and labels.}		% 标题
\label{table:data}		% 创建标签
\end{table}

Beamer

\documentclass{beamer}					% 声明为Beamer幻灯片类
\usepackage[utf8]{inputenc}

\usetheme{Madrid}
\usecolortheme{default}

%------------------------------------------------------------
%This block of code defines the information to appear in the
%Title page
\title[About Beamer] %optional		方括号中设置一个可选的较短标题,在底部出现
{About the Beamer class in presentation making}		% 标题必须在大括号内

\subtitle{A short story}		% 副标题

\author[Arthur, Doe] % (optional)    姓名简短版本,在底部出现,若省略则显示全名
{A.~B.~Arthur\inst{1} \and J.~Doe\inst{2}}		% 多人用\and连接,\inst{1}放上标来表示机构

\institute[VFU] % (optional)	VFU为缩写,在底部人名后出现
{
  \inst{1}%
  Faculty of Physics\\
  Very Famous University
  \and
  \inst{2}%
  Faculty of Chemistry\\
  Very Famous University
}

\date[VLC 2021] % (optional)		出现在PPT底部
{Very Large Conference, April 2021}

\logo{\includegraphics[height=1cm]{overleaf-logo}}		% 徽标显示在右下角

%End of title page configuration block
%------------------------------------------------------------



%------------------------------------------------------------
%The next block of commands puts the table of contents at the 
%beginning of each section and highlights the current section:

\AtBeginSection[]			% 生成总目录
{
  \begin{frame}
    \frametitle{Table of Contents}
    \tableofcontents[currentsection]
  \end{frame}
}								
%------------------------------------------------------------


\begin{document}

%The next statement creates the title page.
\frame{\titlepage}				% 生成标题页,类似于maketitle


%---------------------------------------------------------
%This block of code is for the table of contents after
%the title page
\begin{frame}				% 有层次感的目录,渐变色
\frametitle{Table of Contents}
\tableofcontents
\end{frame}
%---------------------------------------------------------


\section{First section}

%---------------------------------------------------------
%Changing visivility of the text
\begin{frame}
\frametitle{Sample frame title}
This is a text in second frame. For the sake of showing an example.

\begin{itemize}								% 无序列表,一个一个的出现
    \item<1-> Text visible on slide 1
    \item<2-> Text visible on slide 2
    \item<3> Text visible on slides 3
    \item<4-> Text visible on slide 4		% -能够去掉前一个出现的
\end{itemize}
\end{frame}

%---------------------------------------------------------


%---------------------------------------------------------
%Example of the \pause command
\begin{frame}
In this slide \pause					% 停顿

the text will be partially visible \pause

And finally everything will be there
\end{frame}
%---------------------------------------------------------

\section{Second section}

%---------------------------------------------------------
%Highlighting text
\begin{frame}
\frametitle{Sample frame title}

In this slide, some important text will be
\alert{highlighted} because it's important.          % 强调\alert{}
Please, don't abuse it.

\begin{block}{Remark}			% 备注
Sample text
\end{block}

\begin{alertblock}{Important theorem}			% 重要定理
Sample text in red box
\end{alertblock}

\begin{examples}				% 例子
Sample text in green box. The title of the block is ``Examples".
\end{examples}
\end{frame}
%---------------------------------------------------------


%---------------------------------------------------------
%Two columns
\begin{frame}
\frametitle{Two-column slide}

\begin{columns}								% 分两列进行

\column{0.5\textwidth}
This is a text in first column.
$$E=mc^2$$
\begin{itemize}
\item First item
\item Second item
\end{itemize}

\column{0.5\textwidth}
This text will be in the second column
and on a second tought this is a nice looking
layout in some cases.
\end{columns}
\end{frame}
%---------------------------------------------------------


\end{document}
posted @ 2022-12-31 16:03  钰见梵星  阅读(2428)  评论(0编辑  收藏  举报