1

I have a school assigment which demands to use Times New Roman for general content and Lucida Caligraphy for image captions.

But I don't know how to do that, when I try to add lucidabr the compiler launches the next error (I think it crashes with tikz library arrows.meta but I'm not sure)

! LaTeX Error: Command `\hbar' already defined.

See the LaTeX manual or LaTeX Companion for explanation.

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}

Am I doing something wrong? Should I use another packager for lucida and which? or How do I solve this error?

I appreciate your time and any help

I use PDFLatex.

  • Why are you loading mathptmx and lucidabr? Given its poorish math support I would never use mathptmx – daleif Nov 30 '21 at 09:08
  • I see no code that would use any kind of Lucida in captions. Besides, you're not using Times as a text font. Are you *really* sure you want captions like in this picture (click)? – egreg Nov 30 '21 at 10:11
  • @egreg yes, that's what my teacher is asking – Eduardo Jiménez Nov 30 '21 at 20:24
  • @daleif mathptmx provides support for Times font, lucidabr for lucida. as I'm using PDFLatex I didn't want to try with this answer, because it says to be for LuaLaTeX or XeLaTeX – Eduardo Jiménez Nov 30 '21 at 20:25
  • Only for text, the math setup for times does not match times very well. In general there are nowadays much better setups. If course the best is never to use times in the first place – daleif Nov 30 '21 at 20:28
  • So how can I setup this? It's really confusing for me. Times new Roman for text, Lucida for captions and you also mention that I should avoid changing the math font – Eduardo Jiménez Nov 30 '21 at 20:33

1 Answers1

1

If you do \usepackage{lucidabr} you will get Lucida for all the document.

The font family name for Lucida Calligraphy is hlce, so you can define a caption format that sets it as the font to use.

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

Here's an edited version of your preamble, with some changes:

  1. it's better to use newtx for Times, rather than the 25-year-old hack that's mathptmx;
  2. package loading should be separated from settings; having the settings scattered between packages makes the preamble more difficult to maintain;
  3. hyperref and cleveref should be loaded last;
  4. there is no UTF8 option.

Look also for <--- notes and decide yourself what to keep.

I commented out \input{Glossaries.tex} because I don't have the file.

\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}

enter image description here

I sympathize with you (and not with your teacher).

egreg
  • 1,121,712