Skip to content
Snippets Groups Projects
FigTabCode.tex 3.1 KiB
Newer Older
\chapter{图片、表格与代码}

\section{图片示例}

所有图片默认存放在主目录下的\texttt{figure/}文件夹内

% \begin{figure}[htbp]
mc's avatar
mc committed
%     % \includegraphics[width=0.5\textwidth]{njuname}
%     \resizebox{0.5\textwidth}{!}{\input{njuname.tikz}}
%     \caption{南京大学名称}
mc's avatar
mc committed
%     \label{fig:njuname}
mc's avatar
mc committed
% 你可以使用\lstinline|figure|环境插入图片,如\cref{fig:njuname},代码如下:
% \begin{lstlisting}[style=LaTeX]
% \begin{figure}
mc's avatar
mc committed
%     % \includegraphics[width=0.5\textwidth]{njuname}
%     \resizebox{0.5\textwidth}{!}{\input{njuname.tikz}}
%     \caption{南京大学名称}
% \end{figure}
% \end{lstlisting}
% \subsection{文字环绕图像}
% % wrapfigure后面不能有空行
% \begin{wrapfigure}{r}{0cm}
%     % \label{fig:njuemblem}
%     % \includegraphics[width=.15\textwidth]{njuemblem}
%     \resizebox{.15\textwidth}{!}{\input{njuemblem.tikz}}
%     \caption{校徽}
% \end{wrapfigure}
% \zhlipsum[3][name=xiangyu]
% \begin{figure}[htbp]
%     \begin{subfigure}{.32\textwidth}
%         \centering
%         % \includegraphics[width=\textwidth]{njuemblem} 
%         \resizebox{\textwidth}{!}{\input{njuemblem.tikz}} 
%         \caption{logo1}
%     \end{subfigure}
%     \begin{subfigure}{.32\textwidth}
%         \centering
%         % \includegraphics[width=\textwidth]{njuemblem}  
%         \resizebox{\textwidth}{!}{\input{njuemblem.tikz}} 
%         \caption{logo2}
%     \end{subfigure}
%     \begin{subfigure}{.32\textwidth}
%         \centering
%         % \includegraphics[width=\textwidth]{njuemblem}  
%         \resizebox{\textwidth}{!}{\input{njuemblem.tikz}} 
%         \caption{logo3}
%     \end{subfigure}
%     \caption{njuemblems}

\section{表格示例}
\begin{table}[htbp]
    \caption{经过测试的环境}
    \label{tab:testtab}
    \begin{tabular}{ccc}
        \toprule
Koishi Jinguji's avatar
Koishi Jinguji committed
        OS & TeX & 测试情况 \\
        \midrule
Koishi Jinguji's avatar
Koishi Jinguji committed
        Windows 10 & TeXLive 2021 &\\
        Windows 10 & MiKTeX &\\
        Windows 10 & TeXLive 2020 & ×\footnote{cleveref在引用章节时不能正常工作}  \\
        Ubuntu 20.04 & TeXLive 2021 &\\
        南大TeX & Overleaf &\\
        \bottomrule
    \end{tabular}
\end{table}
你可以使用\lstinline|table|环境插入标准三线表,如\cref{tab:testtab}所示,代码如下:
\begin{lstlisting}[style=LaTeX]
\begin{table}[htbp]
    \caption{经过测试的环境}
    \begin{tabular}{ccc}
        \toprule
Koishi Jinguji's avatar
Koishi Jinguji committed
        OS & TeX & 测试情况 \\
        \midrule
Koishi Jinguji's avatar
Koishi Jinguji committed
        Windows 10 & TeXLive 2021 &\\
        Windows 10 & MiKTeX &\\
        Windows 10 & TeXLive 2020 & × \\
        Ubuntu 20.04 & TeXLive 2021 &\\
        南大TeX & Overleaf &\\
        \bottomrule
    \end{tabular}
\end{table}}
\end{lstlisting}



\section{代码示例}


\subsection{行内代码}
The new command pretty-prints the code. The exclamation marks delimit
the code and can be replaced by any character not in the code;
\lstinline$var i:integer;$ gives the same result.
Koishi Jinguji's avatar
Koishi Jinguji committed
使用\lstinline!\lstinline|\textit{<Your code>}|!,只要使用在代码中未出现的符号将代码包括在内即可。