문서의 모든 표에서 글꼴 변경

문서의 모든 표에서 글꼴 변경

내 문서의 모든 테이블에 있는 기본 글꼴을 변경하고 싶습니다. 나는 Computer Modern Roman 글꼴 대신 "축소된" Bitstream Charter Mathdesign(동일 계열)을 선호합니다.

\documentclass{article}
\usepackage[charter, uppercase=upright]{mathdesign}

\makeatletter
\renewcommand{\sfdefault}{cmr}

\g@addto@macro{\table}{\fontencoding{T1}\fontfamily{mdbch}\selectfont}
\makeatother

\begin{document}

\begin{table}
    \caption{My Table}\label{tab:table}
    \centering
    \begin{tabular}{cc}\hline
      X & Y \\ \hline
      x1 & y1 \\
      x2 & y2 \\ \hline
    \end{tabular}
\end{table}

Some short text outside a table in a current font.

\end{document}

다음 코드를 사용하면 전체 문서에 Mathdesign 글꼴이 사용됩니다. :-(

당신의 도움을 주셔서 대단히 감사합니다.

답변1

아마도 환경 명령과 다른 별명을 사용하여 다른 방식으로 해결되었을 것입니다.

\documentclass{article}

\makeatletter
\renewenvironment{table}
     {\renewcommand\familydefault{mdbch}
      \@float{table}}
     {\end@float}
\makeatother

\begin{document}

\begin{table}
    \caption{My Table}\label{tab:table}
    \centering
    \begin{tabular}{cc}\hline
      X & Y \\ \hline
      x1 & y1 \\
      x2 & y2 \\ \hline
    \end{tabular}
\end{table}

Some short text outside a table in a current font.

\end{document}

아마도 도움이 될 것입니다....

관련 정보