Latex

Latex 常见错误

2018-09-19  本文已影响0人  Yao_Fairytale
  1. You might wish to put this between a pair of '{}'
    指代不明确的部分要用大括号括起来
    例如
\sum_if_i^{(n)}=0 %错误
{\sum_i}f_i^{(n)}=0 %正确 
\left( \frac{c-u}{a}\right)^2%错误
{\left( \frac{c-u}{a}\right)}^2%正确
  1. Non-breaking space ('~') should have been used.
    这种引用命令前使用~
Equation \eqref{eqn:1.1} %错误
Figure \ref{fig:1.1}%错误
said by ** \cite{paper:1.1}%错误
Equation~\eqref{eqn:1.1}%正确 
Figure~\ref{fig:1.1}%正确
said by **~\cite{paper:1.1}%正确
  1. Vertical rules in tables are ugly
    丑陋的表格,添加宏包 \usepackage{array,hhline},使用\hhline代替\hline。产生错误的原因是表格竖线在Tex里面不容易生成,且竖线在表格中越来越不流行。使用hline的竖线容易被隔断,不好看。
    或者使用 \usepackage{booktabs} ,这个生成的表格比较好看。里面严禁使用竖线

示例:

\documentclass[]{article}
\usepackage{booktabs} 
\usepackage{array,hhline}
\begin{document}
%----------------------------------------------
%错误1
%----------------------------------------------
\begin{table}
\begin{tabular}{|c|c|c|}
\hline
State&Remainder&Answer\\
\hline \hline
Start&000000&000000\\ \hline
2& & \\ \hline
1& & \\ \hline
0& & \\ \hline
\end{tabular}\end{table}
%----------------------------------------------
%错误2
%----------------------------------------------
\begin{table}
\begin{tabular}{|c|c|c|}
\hhline{|---|}
State&Remainder&Answer\\
\hhline{|===|}
Start&000000&000000\\ \hhline{|---|}
2& & \\ \hhline{|---|}
1& & \\ \hhline{|---|}
0& & \\ \hhline{|---|}
\end{tabular}\end{table}
%----------------------------------------------
%错误3
%----------------------------------------------

\begin{table}
\begin{tabular}{|c|c|c|}
\toprule  %添加表格头部粗线
State&Remainder&Answer\\
\midrule  %添加表格中横线
\midrule
Start&000000&000000\\\midrule
2& & \\ \midrule
1& & \\ \midrule
0& & \\ 
\bottomrule %添加表格底部粗线
\end{tabular}
\end{table}
%----------------------------------------------
%正确示范
%----------------------------------------------
\begin{table}
\begin{tabular}{ccc}
\toprule  %添加表格头部粗线
State&Remainder&Answer\\
\midrule\midrule  %添加表格中横线
Start&000000&000000\\\midrule
2& & \\ \midrule
1& & \\ \midrule
0& & \\ 
\bottomrule %添加表格底部粗线
\end{tabular}
\end{table}
\end{document}

效果图

效果图
上一篇下一篇

猜你喜欢

热点阅读