我使用 LaTeX Overleaf (overleaf.com) 已经有一段时间了,我一直在尝试创建一个三角函数表。在表格的第一行中,我尝试将第一个单元格中的字母加粗,但如果我将其放在美元符号内,就会产生大量错误并使 pdf 转换器崩溃。如果我将其放在\textbf
美元符号外,就不会使字母加粗。有人能帮我解决这个问题吗?谢谢!我的代码在本段下面。
\begin{tabular}{||c|c|c|c||c|c|c||}
\hline
\hline
$\textbf{\alpha}$ &sin($\alpha$) &cos($\alpha$) &tan($\alpha$) &cosec($\alpha$) &sec($\alpha$) &cot($\alpha$)\\
\hline
\hline
\textbf{0}$^\circ$ & $\textbf{0}$ &$\textbf{1}$ &$\textbf{0}$ &\textbf{undefined} &$\textbf{1}$ &\textbf{undefined}\\
\hline
\hline
$15^\circ$ &$\frac{\sqrt{6}-\sqrt{2}}{4}$ &$\frac{\sqrt{6}+\sqrt{2}}{4}$ &$2-\sqrt{3}$ &$\sqrt{6}+\sqrt{2}$ &$\sqrt{6}-\sqrt{2}$ &$2+\sqrt{3}$\\
\hline
$30^\circ$ &$\frac{1}{2}$ &$\frac{\sqrt{3}}{2}$ &$\frac{\sqrt{3}}{3}$ &$2$ &$\frac{2\sqrt{3}}{3}$ &$\sqrt{3}$\\
\hline
$45^\circ$ &$\frac{\sqrt{2}}{2}$ &$\frac{\sqrt{2}}{2}$ &$1$ &$\sqrt{2}$ &$\sqrt{2}$ &$1$\\
\hline
$60^\circ$ &$\frac{\sqrt{3}}{2}$ &$\frac{1}{2}$ &$\sqrt{3}$ &$\frac{2\sqrt{3}}{3}$ &$2$ &$\frac{\sqrt{3}}{3}$\\
\hline
$75^\circ$ &$\frac{\sqrt{6}+\sqrt{2}}{4}$ &$\frac{\sqrt{6}-\sqrt{2}}{4}$ &$2+\sqrt{3}$ &$\sqrt{6}-\sqrt{2}$ &$\sqrt{6}+\sqrt{2}$ &$2-\sqrt{3}$\\
\hline
\hline
$90^\circ$ &$1$ &$0$ &undefined &$1$ &undefined &$0$\\
\hline
\hline
$105^\circ$ &$\frac{\sqrt{6}+{\sqrt{2}}}{4}$ &$\frac{\sqrt{2}-\sqrt{6}}{4}$ &$-2-\sqrt{3}$ &$\sqrt{6}-\sqrt{2}$ &$-\sqrt{6}-\sqrt{2}$ &$\sqrt{3}-2$\\
\hline
$120^\circ$ &$\frac{\sqrt{3}}{2}$ &$-\frac{1}{2}$ &$-\sqrt{3}$ &$\frac{2\sqrt{3}}{3}$ &$-2$ &$-\frac{\sqrt{3}}{3}$\\
\hline
$135^\circ$ &$\frac{\sqrt{2}}{2}$ &$-\frac{\sqrt{2}}{2}$ &$-1$ &$\sqrt{2}$ &$-\sqrt{2}$ &$-1$\\
\hline
$150^\circ$ &$\frac{1}{2}$ &$-\frac{\sqrt{3}}{2}$ &$-\frac{\sqrt{3}}{3}$ &$2$ &$-\frac{2\sqrt{3}}{3}$ &$-\sqrt{3}$\\
\hline
$165^\circ$ &$\frac{\sqrt{6}-\sqrt{2}}{4}$ &$\frac{-\sqrt{6}-\sqrt{2}}{4}$ &$\sqrt{3}-2$ &$\sqrt{6}+\sqrt{2}$ &$\sqrt{2}-\sqrt{6}$ &$-2-\sqrt{3}$\\
\hline
\hline
$180^\circ$ &$0$ &$-1$ &$0$ &undefined &$-1$ &undefined\\
\hline
\hline
$195^\circ$ &$\frac{\sqrt{2}-\sqrt{6}}{4}$ &$\frac{-\sqrt{6}-\sqrt{2}}{4}$ &$2-\sqrt{3}$ &$-\sqrt{6}-\sqrt{2}$ &$\sqrt{2}-\sqrt{6}$ &$2+\sqrt{3}$\\
\hline
$210^\circ$ &$-\frac{1}{2}$ &$-\frac{\sqrt{3}}{2}$ &$\frac{\sqrt{3}}{3}$ &$-2$ &$-\frac{2\sqrt{3}}{3}$ &$\sqrt{3}$\\
\hline
$225^\circ$ &$-\frac{\sqrt{2}}{2}$ &$-\frac{\sqrt{2}}{2}$ &$1$ &$-\sqrt{2}$ &$-\sqrt{2}$ &$1$\\
\hline
$240^\circ$ &$-\frac{\sqrt{3}}{2}$ &$-\frac{1}{2}$ &$\sqrt{3}$ &$-\frac{2\sqrt{3}}{3}$ &$-2$ &$\frac{\sqrt{3}}{3}$\\
\hline
$255^\circ$ &$\frac{-\sqrt{6}-\sqrt{2}}{4}$ &$\frac{\sqrt{2}-\sqrt{6}}{4}$ &$2+\sqrt{3}$ &$\sqrt{6}-\sqrt{2}$ &$-\sqrt{6}-\sqrt{2}$ &$2-\sqrt{3}$\\
\hline
\hline
$270^\circ$ &$-1$ &$0$ &undefined &$1$ &undefined &$0$\\
\hline
\hline
$285^\circ$ &$\frac{-\sqrt{6}-\sqrt{2}}{4}$ &$\frac{\sqrt{6}-\sqrt{2}}{4}$ &$-2-\sqrt{3}$ &$\sqrt{2}-\sqrt{6}$ &$\sqrt{2}+\sqrt{6}$ &$\sqrt{3}-2$\\
\hline
$300^\circ$ &$-\frac{\sqrt{3}}{2}$ &$\frac{1}{2}$ &$-\sqrt{3}$ &$-\frac{2\sqrt{3}}{3}$ &$2$ &$-\frac{\sqrt{3}}{3}$\\
\hline
$315^\circ$ &$-\frac{\sqrt{2}}{2}$ &$\frac{\sqrt{2}}{2}$ &$-1$ &$-\sqrt{2}$ &$\sqrt{2}$ &$-1$\\
\hline
$330^\circ$ &$-\frac{1}{2}$ &$\frac{\sqrt{3}}{2}$ &$-\frac{\sqrt{3}}{3}$ &$-2$ &$\frac{2\sqrt{3}}{3}$ &$-\sqrt{3}$\\
\hline
$345^\circ$ &$\frac{\sqrt{2}-\sqrt{6}}{4}$ &$\frac{\sqrt{6}+\sqrt{2}}{4}$ &$\sqrt{3}-2$ &$-\sqrt{6}-\sqrt{2}$ &$\sqrt{6}-\sqrt{2}$ &$-2-\sqrt{3}$\\
\hline
\hline
$360^\circ$ &$0$ &$1$ &$0$ &undefined &$1$ &undefined\\
\hline
\hline
\end{tabular}
\end{center}
答案1
您可能喜欢以下表格设计:
通过将表格放入显示数学环境中并使用tabularray
包,表格代码会更短,表格也会变得更美观。当然,你应该分别使用和而不是textbf{<text>}
和\textbf{<symbol>}
mathbf{<text>}
\boldsymbol{<symbol>}
\documentclass{article}
\usepackage{xcolor}
\usepackage{tabularray}
\UseTblrLibrary{amsmath}
\DeclareMathOperator{\cosec}{cosec}
\begin{document}
\[
\begin{tblr}{hlines, vlines,
cells = {c},
row{2,8,14,20,Z} = {bg=gray!20}
}
\boldsymbol{\alpha} & \sin(\alpha) & \cos(\alpha) & \tan(\alpha) &\cosec(\alpha) & \sec(\alpha) & \cot(\alpha) \\
%
\mathbf{0}^\circ & \mathbf{0} &\mathbf{1} &\mathbf{0} &\mathbf{undefined} &\mathbf{1} &\mathbf{undefined}\\
15^\circ &\frac{\sqrt{6}-\sqrt{2}}{4} &\frac{\sqrt{6}+\sqrt{2}}{4} &2-\sqrt{3} &\sqrt{6}+\sqrt{2} &\sqrt{6}-\sqrt{2} &2+\sqrt{3}\\
30^\circ &\frac{1}{2} &\frac{\sqrt{3}}{2} &\frac{\sqrt{3}}{3} &2 &\frac{2\sqrt{3}}{3} &\sqrt{3}\\
45^\circ &\frac{\sqrt{2}}{2} &\frac{\sqrt{2}}{2} &1 &\sqrt{2} &\sqrt{2} &1\\
60^\circ &\frac{\sqrt{3}}{2} &\frac{1}{2} &\sqrt{3} &\frac{2\sqrt{3}}{3} &2 &\frac{\sqrt{3}}{3}\\
75^\circ &\frac{\sqrt{6}+\sqrt{2}}{4} &\frac{\sqrt{6}-\sqrt{2}}{4} &2+\sqrt{3} &\sqrt{6}-\sqrt{2} &\sqrt{6}+\sqrt{2} &2-\sqrt{3}\\
90^\circ &1 &0 &\mathbf{undefined} &1 &\mathbf{undefined} &0\\
105^\circ &\frac{\sqrt{6}+{\sqrt{2}}}{4} &\frac{\sqrt{2}-\sqrt{6}}{4} &-2-\sqrt{3} &\sqrt{6}-\sqrt{2} &-\sqrt{6}-\sqrt{2} &\sqrt{3}-2\\
120^\circ &\frac{\sqrt{3}}{2} &-\frac{1}{2} &-\sqrt{3} &\frac{2\sqrt{3}}{3} &-2 &-\frac{\sqrt{3}}{3}\\
135^\circ &\frac{\sqrt{2}}{2} &-\frac{\sqrt{2}}{2} &-1 &\sqrt{2} &-\sqrt{2} &-1\\
150^\circ &\frac{1}{2} &-\frac{\sqrt{3}}{2} &-\frac{\sqrt{3}}{3} &2 &-\frac{2\sqrt{3}}{3} &-\sqrt{3}\\
165^\circ &\frac{\sqrt{6}-\sqrt{2}}{4} &\frac{-\sqrt{6}-\sqrt{2}}{4} &\sqrt{3}-2 &\sqrt{6}+\sqrt{2} &\sqrt{2}-\sqrt{6} &-2-\sqrt{3}\\
180^\circ &0 &-1 &0 &\mathbf{undefined} &-1 &\mathbf{undefined}\\
195^\circ &\frac{\sqrt{2}-\sqrt{6}}{4} &\frac{-\sqrt{6}-\sqrt{2}}{4} &2-\sqrt{3} &-\sqrt{6}-\sqrt{2} &\sqrt{2}-\sqrt{6} &2+\sqrt{3}\\
210^\circ &-\frac{1}{2} &-\frac{\sqrt{3}}{2} &\frac{\sqrt{3}}{3} &-2 &-\frac{2\sqrt{3}}{3} &\sqrt{3}\\
225^\circ &-\frac{\sqrt{2}}{2} &-\frac{\sqrt{2}}{2} &1 &-\sqrt{2} &-\sqrt{2} &1\\
240^\circ &-\frac{\sqrt{3}}{2} &-\frac{1}{2} &\sqrt{3} &-\frac{2\sqrt{3}}{3} &-2 &\frac{\sqrt{3}}{3}\\
255^\circ &\frac{-\sqrt{6}-\sqrt{2}}{4} &\frac{\sqrt{2}-\sqrt{6}}{4} &2+\sqrt{3} &\sqrt{6}-\sqrt{2} &-\sqrt{6}-\sqrt{2} &2-\sqrt{3}\\
270^\circ &-1 &0 &\mathbf{undefined} &1 &\mathbf{undefined} &0\\
285^\circ &\frac{-\sqrt{6}-\sqrt{2}}{4} &\frac{\sqrt{6}-\sqrt{2}}{4} &-2-\sqrt{3} &\sqrt{2}-\sqrt{6} &\sqrt{2}+\sqrt{6} &\sqrt{3}-2\\
300^\circ &-\frac{\sqrt{3}}{2} &\frac{1}{2} &-\sqrt{3} &-\frac{2\sqrt{3}}{3} &2 &-\frac{\sqrt{3}}{3}\\
315^\circ &-\frac{\sqrt{2}}{2} &\frac{\sqrt{2}}{2} &-1 &-\sqrt{2} &\sqrt{2} &-1\\
330^\circ &-\frac{1}{2} &\frac{\sqrt{3}}{2} &-\frac{\sqrt{3}}{3} &-2 &\frac{2\sqrt{3}}{3} &-\sqrt{3}\\
345^\circ &\frac{\sqrt{2}-\sqrt{6}}{4} &\frac{\sqrt{6}+\sqrt{2}}{4} &\sqrt{3}-2 &-\sqrt{6}-\sqrt{2} &\sqrt{6}-\sqrt{2} &-2-\sqrt{3}\\
360^\circ &0 &1 &0 &\mathbf{undefined} &1 &\mathbf{undefined}\\
\end{tblr}
\]
\end{document}
答案2
看了 Zarko 的评论后,我知道我可以在文档中尝试后$\textbf{\alpha}$
用替换$\boldsymbol\alpha$
。这里有效的代码是:
\begin{tabular}{||c|c|c|c||c|c|c||}
\hline
\hline
$\boldsymbol\alpha$ &sin($\alpha$) &cos($\alpha$) &tan($\alpha$) &cosec($\alpha$) &sec($\alpha$) &cot($\alpha$)\\
\hline
\hline
\textbf{0}$^\circ$ & $\textbf{0}$ &$\textbf{1}$ &$\textbf{0}$ &\textbf{undefined} &$\textbf{1}$ &\textbf{undefined}\\
\hline
\hline
$15^\circ$ &$\frac{\sqrt{6}-\sqrt{2}}{4}$ &$\frac{\sqrt{6}+\sqrt{2}}{4}$ &$2-\sqrt{3}$ &$\sqrt{6}+\sqrt{2}$ &$\sqrt{6}-\sqrt{2}$ &$2+\sqrt{3}$\\
\hline
$30^\circ$ &$\frac{1}{2}$ &$\frac{\sqrt{3}}{2}$ &$\frac{\sqrt{3}}{3}$ &$2$ &$\frac{2\sqrt{3}}{3}$ &$\sqrt{3}$\\
\hline
$45^\circ$ &$\frac{\sqrt{2}}{2}$ &$\frac{\sqrt{2}}{2}$ &$1$ &$\sqrt{2}$ &$\sqrt{2}$ &$1$\\
\hline
$60^\circ$ &$\frac{\sqrt{3}}{2}$ &$\frac{1}{2}$ &$\sqrt{3}$ &$\frac{2\sqrt{3}}{3}$ &$2$ &$\frac{\sqrt{3}}{3}$\\
\hline
$75^\circ$ &$\frac{\sqrt{6}+\sqrt{2}}{4}$ &$\frac{\sqrt{6}-\sqrt{2}}{4}$ &$2+\sqrt{3}$ &$\sqrt{6}-\sqrt{2}$ &$\sqrt{6}+\sqrt{2}$ &$2-\sqrt{3}$\\
\hline
\hline
$90^\circ$ &$1$ &$0$ &undefined &$1$ &undefined &$0$\\
\hline
\hline
$105^\circ$ &$\frac{\sqrt{6}+{\sqrt{2}}}{4}$ &$\frac{\sqrt{2}-\sqrt{6}}{4}$ &$-2-\sqrt{3}$ &$\sqrt{6}-\sqrt{2}$ &$-\sqrt{6}-\sqrt{2}$ &$\sqrt{3}-2$\\
\hline
$120^\circ$ &$\frac{\sqrt{3}}{2}$ &$-\frac{1}{2}$ &$-\sqrt{3}$ &$\frac{2\sqrt{3}}{3}$ &$-2$ &$-\frac{\sqrt{3}}{3}$\\
\hline
$135^\circ$ &$\frac{\sqrt{2}}{2}$ &$-\frac{\sqrt{2}}{2}$ &$-1$ &$\sqrt{2}$ &$-\sqrt{2}$ &$-1$\\
\hline
$150^\circ$ &$\frac{1}{2}$ &$-\frac{\sqrt{3}}{2}$ &$-\frac{\sqrt{3}}{3}$ &$2$ &$-\frac{2\sqrt{3}}{3}$ &$-\sqrt{3}$\\
\hline
$165^\circ$ &$\frac{\sqrt{6}-\sqrt{2}}{4}$ &$\frac{-\sqrt{6}-\sqrt{2}}{4}$ &$\sqrt{3}-2$ &$\sqrt{6}+\sqrt{2}$ &$\sqrt{2}-\sqrt{6}$ &$-2-\sqrt{3}$\\
\hline
\hline
$180^\circ$ &$0$ &$-1$ &$0$ &undefined &$-1$ &undefined\\
\hline
\hline
$195^\circ$ &$\frac{\sqrt{2}-\sqrt{6}}{4}$ &$\frac{-\sqrt{6}-\sqrt{2}}{4}$ &$2-\sqrt{3}$ &$-\sqrt{6}-\sqrt{2}$ &$\sqrt{2}-\sqrt{6}$ &$2+\sqrt{3}$\\
\hline
$210^\circ$ &$-\frac{1}{2}$ &$-\frac{\sqrt{3}}{2}$ &$\frac{\sqrt{3}}{3}$ &$-2$ &$-\frac{2\sqrt{3}}{3}$ &$\sqrt{3}$\\
\hline
$225^\circ$ &$-\frac{\sqrt{2}}{2}$ &$-\frac{\sqrt{2}}{2}$ &$1$ &$-\sqrt{2}$ &$-\sqrt{2}$ &$1$\\
\hline
$240^\circ$ &$-\frac{\sqrt{3}}{2}$ &$-\frac{1}{2}$ &$\sqrt{3}$ &$-\frac{2\sqrt{3}}{3}$ &$-2$ &$\frac{\sqrt{3}}{3}$\\
\hline
$255^\circ$ &$\frac{-\sqrt{6}-\sqrt{2}}{4}$ &$\frac{\sqrt{2}-\sqrt{6}}{4}$ &$2+\sqrt{3}$ &$\sqrt{6}-\sqrt{2}$ &$-\sqrt{6}-\sqrt{2}$ &$2-\sqrt{3}$\\
\hline
\hline
$270^\circ$ &$-1$ &$0$ &undefined &$1$ &undefined &$0$\\
\hline
\hline
$285^\circ$ &$\frac{-\sqrt{6}-\sqrt{2}}{4}$ &$\frac{\sqrt{6}-\sqrt{2}}{4}$ &$-2-\sqrt{3}$ &$\sqrt{2}-\sqrt{6}$ &$\sqrt{2}+\sqrt{6}$ &$\sqrt{3}-2$\\
\hline
$300^\circ$ &$-\frac{\sqrt{3}}{2}$ &$\frac{1}{2}$ &$-\sqrt{3}$ &$-\frac{2\sqrt{3}}{3}$ &$2$ &$-\frac{\sqrt{3}}{3}$\\
\hline
$315^\circ$ &$-\frac{\sqrt{2}}{2}$ &$\frac{\sqrt{2}}{2}$ &$-1$ &$-\sqrt{2}$ &$\sqrt{2}$ &$-1$\\
\hline
$330^\circ$ &$-\frac{1}{2}$ &$\frac{\sqrt{3}}{2}$ &$-\frac{\sqrt{3}}{3}$ &$-2$ &$\frac{2\sqrt{3}}{3}$ &$-\sqrt{3}$\\
\hline
$345^\circ$ &$\frac{\sqrt{2}-\sqrt{6}}{4}$ &$\frac{\sqrt{6}+\sqrt{2}}{4}$ &$\sqrt{3}-2$ &$-\sqrt{6}-\sqrt{2}$ &$\sqrt{6}-\sqrt{2}$ &$-2-\sqrt{3}$\\
\hline
\hline
$360^\circ$ &$0$ &$1$ &$0$ &undefined &$1$ &undefined\\
\hline
\hline
\end{tabular}
\end{center}