表:更改字体系列

表:更改字体系列

我太习惯使用 markdown pandoc latex => pdf 组合了,以至于我的 LaTeX 技能都快被遗忘了。有时我需要在 markdown 中使用比 markdown 表格提供的更好的表格布局。所以我用 LaTeX 插入它。

我需要将表格改为固定字体大小,以便所有数字彼此对齐;

预先感谢您的帮助

马雷克

ps:需要修改的标签:不允许使用LaTeX和Fontfamily!

这里有一个 tex 中的最小示例:

\documentclass[12pt,a4paper]{scrartcl}
\usepackage{xcolor}
\definecolor{mygray}{gray}{.55}
\definecolor{myblue}{rgb}{0.25,0.45,0.75}
\definecolor{myviolet}{rgb}{0.6,0.4,0.8}
\definecolor{myred}{rgb}{.6,0,0}
\definecolor{mygreen}{rgb}{.31,.47,.26}
\definecolor{myorange}{rgb}{1,.49,.0}

\begin{document}

\begin{tabular}{c c c c}
    \textcolor{myblue}{NNNNNNNN} & \textcolor{myblue}{NNNNNNNN} & \textcolor{myblue}{NNNNNNNN} & \textcolor{myred}{HHHHHHHH}\\
    \textcolor{myblue}{11111111} & \textcolor{myblue}{11111111} & \textcolor{myblue}{11111111} & \textcolor{myred}{00000000}
\end{tabular}

A subnet mask of a classfull IP /24 has 1s for all \textcolor{myblue}{Network bits} and 0s for all \textcolor{myred}{Host bits}. 

If you are \textcolor{myviolet}{subnetting} a classfull net, you are borrowing bits from the \textcolor{myred}{Host part}. For example a /26 subnet mask in binary would look like follows:

\begin{tabular}{c c c c}
    \textcolor{myblue}{NNNNNNNN} & \textcolor{myblue}{NNNNNNNN} & \textcolor{myblue}{NNNNNNNN} & \textcolor{myviolet}{SS}\textcolor{myred}{HHHHHH}\\
    \textcolor{myblue}{11111111} & \textcolor{myblue}{11111111} & \textcolor{myblue}{11111111} & \textcolor{myviolet}{11}\textcolor{myred}{000000}
\end{tabular}

\end{document}

答案1

\ttfamily您可以在列规范中指定大多数颜色和用途。

\documentclass[12pt,a4paper]{scrartcl}
\usepackage[table]{xcolor}
\definecolor{mygray}{gray}{.55}
\definecolor{myblue}{rgb}{0.25,0.45,0.75}
\definecolor{myviolet}{rgb}{0.6,0.4,0.8}
\definecolor{myred}{rgb}{.6,0,0}
\definecolor{mygreen}{rgb}{.31,.47,.26}
\definecolor{myorange}{rgb}{1,.49,.0}

\begin{document}

\begin{center}
\begin{tabular}{ 
  *{3}{>{\color{myblue}\ttfamily}c}
  >{\color{myred}\ttfamily}c
}
  NNNNNNNN & NNNNNNNN & NNNNNNNN & HHHHHHHH\\
  11111111 & 11111111 & 11111111 & 00000000
\end{tabular}
\end{center}
A subnet mask of a classfull IP /24 has 1s for all \textcolor{myblue}{Network bits} 
and 0s for all \textcolor{myred}{Host bits}. 

If you are \textcolor{myviolet}{subnetting} a classfull net, you are borrowing 
bits from the \textcolor{myred}{Host part}. For example a /26 subnet mask in 
binary would look like follows:
\begin{center}
\begin{tabular}{
  *{3}{>{\color{myblue}\ttfamily}c}
  >{\ttfamily}c
}
  NNNNNNNN & NNNNNNNN & NNNNNNNN & \textcolor{myviolet}{SS}\textcolor{myred}{HHHHHH}\\
  11111111 & 11111111 & 11111111 & \textcolor{myviolet}{11}\textcolor{myred}{000000}
\end{tabular}
\end{center}

\end{document}

在此处输入图片描述

相关内容