Lucida br, ! LaTeX 错误:命令“\hbar”已定义

Lucida br, ! LaTeX 错误:命令“\hbar”已定义

我有一个学校作业,要求使用 Times New Roman 字体书写一般内容,使用 Lucida Caligraphy 字体书写图像标题。

但我不知道该怎么做,当我尝试添加lucidabr编译器启动下一个错误(我认为它与 tikz 库崩溃,arrows.meta但我不确定)

!LaTeX 错误:命令‘\hbar’已定义。

请参阅 LaTeX 手册或 LaTeX Companion 以获取解释。

l.673 ...reMathSymbol{\hbar}{\mathord}{arrows}{27}

\documentclass[UTF8,12pt]{article}

%%%%%%%   Document configuration   %%%%%%%
\usepackage[english,spanish,es-tabla]{babel}
\usepackage[letterpaper, margin=2.5cm]{geometry}
\setlength{\parskip}{1em}
\usepackage{ragged2e}
\decimalpoint
%%%%%%%%%%%%%%%%%%%%%%%%%%

%%%%%%%%%%%   Fonts  %%%%%%%%%%%
\usepackage{mathptmx}
\usepackage{titlesec}

\titleformat{\section}{\normalfont\fontsize{16}{15}\bfseries}{\thesection}{1em}{}
\titleformat{\subsection}{\normalfont\fontsize{14}{15}\bfseries}{\thesubsection}{1em}{}
\titleformat{\subsubsection}{\normalfont\fontsize{14}{15}\bfseries}{\thesubsection}{1em}{}

\titlespacing\section{0pt}{12pt plus 4pt minus 2pt}{0pt plus 2pt minus 2pt}
\titlespacing\subsection{0pt}{8pt plus 4pt minus 2pt}{0pt plus 2pt minus 2pt}
\titlespacing\subsubsection{0pt}{8pt plus 4pt minus 2pt}{0pt plus 2pt minus 2pt}

\usepackage[T1]{fontenc}
\usepackage{textcomp}
% The line below produces the error mentioned in 1.%
\usepackage[altbullet]{lucidabr}
%%%%%%%%%%%%%%%%%%%%%%%%%%

%%%%%%%%%%%  Other  %%%%%%%%%%%
\usepackage[shortlabels]{enumitem}
\usepackage[hidelinks]{hyperref}
\usepackage{multicol}
\usepackage{adjustbox}
\usepackage[normalem]{ulem}
%%%%%%%%%%%%%%%%%%%%%%%%%%

%%%%%%%%%%%   Math   %%%%%%%%%%%
\usepackage{amsmath}
\usepackage{siunitx}
\usepackage{xfrac}
\sisetup{per-mode = fraction, group-separator={,}}
%%%%%%%%%%%%%%%%%%%%%%%%%%

%%%%%%%%%%     Figures     %%%%%%%%%%
\usepackage{graphicx}
\graphicspath{{./Figures/}}
\usepackage[font=small, labelsep=period]{caption}
\usepackage{subcaption}
\usepackage[capposition=top]{floatrow}
\usepackage[spanish]{cleveref}
%%%%%%%%%%%%%%%%%%%%%%%%%%

%%%%%%%%%%      Draws      %%%%%%%%%%
\usepackage{tikz}
\usetikzlibrary{shapes.geometric, arrows.meta}
%%%%%%%%%%%%%%%%%%%%%%%%%%

%%%%%%%%%%   Glossaries   %%%%%%%%%%
\usepackage[toc, acronym]{glossaries}
\makeglossaries
\loadglsentries{Glossary.tex}
%%%%%%%%%%%%%%%%%%%%%%%%%%

%%%%%%%%%% Bibliography %%%%%%%%%%
\usepackage[backend=biber,style=apa,citestyle=apa,hyperref=true,url=true]{biblatex}
\addbibresource{References.bib}
\usepackage{csquotes}
\setquotestyle[mexican]{spanish}
%%%%%%%%%%%%%%%%%%%%%%%%%%

\begin{document}
    \pagenumbering{gobble}
    \nocite{*}
    \frenchspacing
    
    All the document is in Times New Roman but figure captions and math
    
\end{document}

我做错了什么吗?我应该为 lucida 使用其他打包程序吗?或者我该如何解决这个错误?

感谢您的时间和任何帮助

我使用 PDFLatex。

答案1

如果你这样做,\usepackage{lucidabr}你将获得所有文档的 Lucida。

Lucida Calligraphy 的字体系列名称是hlce,因此您可以定义一个标题格式,将其设置为要使用的字体。

\DeclareCaptionFormat{lucidacalligraphic}{\fontfamily{hlce}\selectfont#1#2#3\par}
\captionsetup{format=lucidacalligraphic}

以下是您序言的编辑版本,其中有一些更改:

  1. 最好用它newtx来做《时代》杂志,而不是那个 25 年前的黑客杂志mathptmx
  2. 包加载应该与设置分开;将设置分散在包之间会使前言更难维护;
  3. hyperref并且cleveref应该最后加载;
  4. 没有UTF8选择。

还需查看<---笔记并自行决定保留哪些内容。

我将其注释掉了,\input{Glossaries.tex}因为我没有该文件。

\documentclass[12pt]{article}

%%% Packages

%%%%%%%   Document configuration   %%%%%%%
\usepackage[english,spanish,es-tabla]{babel}
\usepackage[letterpaper, margin=2.5cm]{geometry}
\usepackage{ragged2e}

%%%%%%%%%%%   Fonts  %%%%%%%%%%%
\usepackage[T1]{fontenc}
%\usepackage{mathptmx} % <--- obsolete
\usepackage{newtxtext,newtxmath}
%\usepackage{textcomp} % <--- no longer needed
%%%%%%%%%%%%%%%%%%%%%%%%%%

%%%%%%%%%%%  Other  %%%%%%%%%%%
\usepackage{multicol}
\usepackage{adjustbox}
\usepackage[normalem]{ulem}
\usepackage{titlesec}
\usepackage[shortlabels]{enumitem}
%%%%%%%%%%%%%%%%%%%%%%%%%%

%%%%%%%%%%%   Math   %%%%%%%%%%%
\usepackage{amsmath}
\usepackage{siunitx}
\usepackage{xfrac}
%%%%%%%%%%%%%%%%%%%%%%%%%%

%%%%%%%%%%     Figures     %%%%%%%%%%
\usepackage{graphicx}
\usepackage[font=small, labelsep=period]{caption}
\usepackage{subcaption}
\usepackage[capposition=top]{floatrow}
%%%%%%%%%%%%%%%%%%%%%%%%%%

%%%%%%%%%%      Draws      %%%%%%%%%%
\usepackage{tikz}
\usetikzlibrary{shapes.geometric, arrows.meta}
%%%%%%%%%%%%%%%%%%%%%%%%%%

%%%%%%%%%%   Glossaries   %%%%%%%%%%
\usepackage[toc, acronym]{glossaries}
%%%%%%%%%%%%%%%%%%%%%%%%%%

%%%%%%%%%% Bibliography %%%%%%%%%%
\usepackage[backend=biber,style=apa,citestyle=apa,hyperref=true,url=true]{biblatex}
\usepackage{csquotes}
%%%%%%%%%%%%%%%%%%%%%%%%%%

%%%%%%%%%% These should be last! %%%%%%%%%%

\usepackage[hidelinks]{hyperref}
\usepackage[spanish]{cleveref}

%%% settings

% biblatex
\addbibresource{References.bib}
\setquotestyle[mexican]{spanish}

% glossaries
\makeglossaries
%\loadglsentries{Glossary.tex}

% graphicx
\graphicspath{{./Figures/}}

% sectional titles
\titleformat{\section}{\normalfont\fontsize{16}{15}\bfseries}{\thesection}{1em}{}
\titleformat{\subsection}{\normalfont\fontsize{14}{15}\bfseries}{\thesubsection}{1em}{}
\titleformat{\subsubsection}{\normalfont\fontsize{14}{15}\bfseries}{\thesubsection}{1em}{}

\titlespacing\section{0pt}{12pt plus 4pt minus 2pt}{0pt plus 2pt minus 2pt}
\titlespacing\subsection{0pt}{8pt plus 4pt minus 2pt}{0pt plus 2pt minus 2pt}
\titlespacing\subsubsection{0pt}{8pt plus 4pt minus 2pt}{0pt plus 2pt minus 2pt}

% siunitx
\sisetup{per-mode = fraction, group-separator={,}}

% captions
\DeclareCaptionFormat{lucidacalligraphic}{\fontfamily{hlce}\selectfont#1#2#3\par}
\captionsetup{format=lucidacalligraphic}

% miscellaneous
\setlength{\parskip}{1em} % <--- Are you really sure?
\decimalpoint


\begin{document}

All the document is in Times New Roman but figure captions should
be in Lucida Calligraphy. Yes, that's right! Oh, no!

\begin{figure}[htp]
\caption{This should not be in Times}
\end{figure}

\end{document}

在此处输入图片描述

我同情你(但同情你的老师)。

相关内容