여러 시스템 글꼴 사용

여러 시스템 글꼴 사용

페이지의 다양한 섹션에 대해 특정 글꼴 크기와 함께 3~4개의 특정 시스템 글꼴(예: Georgia, HelveticaNeui Light 및 Lucida Sans)을 사용하고 싶습니다. 어떻게 해야 할까요?

편집: 답변해 주셔서 감사합니다. 나는 보았다fontspec패키지에는 있지만 내가 찾은 예제는 서문, 등에 정의되어 있습니다 \setmainfont{}. \setsansfont{}글꼴군을 정의하고 특정 섹션에 대해 참조하는 방법을 알 수 없었습니다. 예는 다음과 같습니다.

\documentclass[12pt]{article}

\usepackage{fontspec}

\begin{document}

\section{Georgia}%here define font

This text shows in Georgia.

\section{Lucida Sans}%

This text shows in Lucida Sans

\section{HelveticaNeue Light}%here define font

This text shows in Helvetica Neue Light

\end{document}

답변1

텍스트 덩어리를 다른 글꼴로 만들고 싶다면 문서에 적합한 의미를 사용하여 해당 텍스트에 대한 환경을 간단히 설정할 수 있습니다. 기억해야 할 주요 사항은 명령을 직접 \newfontfamily사용하는 것보다 각 글꼴에 대한 글꼴 전환 명령을 정의하는 데 사용해야 한다는 것입니다 \fontspec. 예를 들어:

% Compile with XeLaTeX or LuaLaTeX
\documentclass[12pt]{article}
\usepackage{fontspec}
\defaultfontfeatures{Ligatures=TeX}

\newfontfamily\calibrifont{Calibri}
\newfontfamily\cambriafont{Cambria}
\newfontfamily\georgiafont{Georgia}

\newenvironment{calibri}{\calibrifont}{\par}
\newenvironment{cambria}{\cambriafont}{\par}
\newenvironment{georgia}{\georgiafont}{\par}

\begin{document}
\begin{calibri}
This text is in Calibri
\end{calibri}
\begin{cambria}
This text is in Cambria
\end{cambria}
\begin{georgia}
This text is in Georgia
\end{georgia}
\end{document}

코드 출력

관련 정보