我只想排版通配符运算符表位于页面下方约 2/3 处。
我一直在工作,甚至不需要看起来好看。我应该使用什么工具?
我正在进行的工作
\documentclass{article}
\begin{document}
\begin{tabular*}{\linewidth}[t]{|l|l| }
\hline
\multicolumn{2}{|c|}{Wild-card Operators} \\ \hline
Character & Function \\ \hline
\_ (underscore) & matches any single character \\ \hline
\multicolumn{2}{|l|}{ \_am Frenc\_ matches Sam French, Tam Frenck, and Lam Frencq} \\ \hline
\% & matches a string of one or more characters \\ \hline
\multicolumn{1}{|l|}{WHERE FirstName LIKE J\% matches any name starting with J} \\ \hline
$[]$ and \^ & Matches any char in specified range, \^ is negation op \\ \hline
\multicolumn{2}{|l|}{[a-g],[\^a-g],[bcdrf]} \\ \hline
\end{tabular*}
\end{document}
答案1
有一种可能性是:我用的是booktabs
包中有更好看的表格(没有垂直规则),并且tabularx
包以避免手动计算第二列的宽度;我还对代码部分使用了等宽字体(至\ttfamily
和):\texttt{}
\documentclass{article}
\usepackage{tabularx}
\usepackage{booktabs}
\begin{document}
\noindent\begin{tabularx}{\linewidth}[t]{>{\ttfamily}lX}
\toprule
\multicolumn{2}{c}{Wild-card Operators} \\
\midrule
\rmfamily Character & Function \\
\cmidrule(r){1-1}\cmidrule(l){2-2}
\_ \rmfamily(underscore)
& matches any single character \texttt{_am Frenc_} matches \texttt{Sam French}, \texttt{Tam Frenck}, and \texttt{Lam Frencq} \\
\%
& matches a string of one or more characters WHERE FirstName LIKE \texttt{J\%} matches any name starting with \texttt{J} \\
{[]} \textrm{and} \^ & Matches any char in specified range, \texttt{\^} is negation op \texttt{[a-g]},\texttt{[\^{}a-g]},\texttt{[bcdrf]} \\
\bottomrule
\end{tabularx}
\end{document}