0

I'm writing a scientific article using CAS bundle from Elsevier, which is a double-column format.

This how my document looks.

\documentclass[a4paper,fleqn]{cas-dc}
\usepackage[numbers]{natbib}
\usepackage{microtype}
\usepackage{amsmath,amssymb,amsthm,bm}
\usepackage{graphicx}
\usepackage[colorlinks]{hyperref}
\usepackage{url}
\usepackage{subcaption}
\usepackage{notoccite} 
\usepackage{float}
\usepackage{stfloats}
\usepackage{caption}

\begin{document}
\section{chapter1}
   ........  my text
\section{chapter2}
   ........  my text
\begin{figure}
   \centering
   \includegraphics[width=\linewidth]{fig1.jpg}
   \label{fig1}
   \caption{This is my problem area, can't have long text}
\end{figure}
   ........ my text
\end{document}

The issue that I'm facing is a little strange because when the caption length of the figure exceeds one line, it throws me this pdfTeX error (font expansion): auto expansion is only possible with scalable fonts.

enter image description here

However, I found that removing the microtype package allows me to have a long caption without any errors but the alignment in the rest of the document gets messed up. Based on the answers from previous posts related to this error, I tried to use \usepackage[T1]{fontenc}, \usepackage{lmodern}, and several options in microtype package (like protrusion, expansion, and final). None of these helps to fix my problem.

I need to have a long figure caption while maintaining the alignment of the rest of my document. I'd really appreciate if someone could help me figure this out.

  • 1
    Welcome to TeX.SX! Please make a compilable example, starting at the \documentclass line, and including a sample image with a caption that throws the error you mention. – Phelype Oleinik Apr 29 '20 at 3:00
  • 1
    Remove microtype but keep the long caption, compile. At the end of the log there should be a list of fonts (ending with pfb or pk). Show this list. – Ulrike Fischer Apr 29 '20 at 6:46
  • @Ulrike Fischer Please find the list below fonts/pk/ljfour/jknappen/ec/dpi600\ecss0900.pk> fonts/pk/ljfour/jknappen/ec/dpi600\ecsx0900.pk> fonts/enc/dvips/inconsolata/i4-t1-0.enc} fonts/enc/dvips/stix/stix-t1.enc} fonts/type1/public/inconsolata/Inconsolata-zi4r.pfb> fonts/type1/public/stix/STIXGeneral-Bold.pfb> fonts/type1/public/stix/STIXGeneral-Italic.pfb fonts/type1/public/stix/STIXGeneral-Regular.pfb> fonts/type1/public/stix/stix-mathit.pfb> fonts/type1/public/stix/stix-mathrm.pfb> – Sid Apr 29 '20 at 13:57
  • 1
    Install the cm-super package. – Ulrike Fischer Apr 29 '20 at 14:22
1

The MWE you provide does not compile for me. When I create my own fig1.jpg (Should this really be a JPEG?) and change linewidth to \linewidth, I cannot reproduce the bug with TeX Live 2019.

The version of cas-dc.cls I have (2.1) loads stix as the math font and charis as the text font, which should both be scalable and work properly. If it can’t find charis, it loads stix as the text font too. It also looks for inconsolata as the fixed-width font, although that should not be causing the problem you have. You should make sure these packages are up-to-date. Are you getting warnings in your log file about them being missing?

If you are loading stix through your class file, it should not be necessary to also load either bm or amssymb, although neither will hurt.

PS

The actual document, unlike the MWE, was using a sans-serif font, and the class file does not load one. Loading any T1 sans-serif font would work.

  • When I use without \usepackage{microtype}, this is how my log file looks. And it continues till the end and generates pdf without any issues. LaTeX Font Info: Try loading font information for T1+cmss on input line 97. ("C:\Users\Sid\AppData\Local\Programs\MiKTeX 2.9\tex/latex/base\t1cmss.fd" File: t1cmss.fd 2014/09/29 v2.5h Standard LaTeX font definitions ) <pflow.jpg, id=25, 851.3406pt x 436.5108pt> File: pflow.jpg Graphic file (type jpg) <use pflow.jpg> Package pdftex.def Info: pflow.jpg used on input line 98. (pdftex.def) Requested size: 238.25444pt x 122.16223pt. – Sid Apr 29 '20 at 5:24
  • Whereas with \usepackage{microtype} this is what I get Package microtype Info: Loading generic protrusion settings for font family (microtype) `cmss' (encoding: T1). (microtype) For optimal results, create family-specific settings. (microtype) See the microtype manual for details. <pflow.jpg, id=25, 851.3406pt x 436.5108pt> File: pflow.jpg Graphic file (type jpg) <use pflow.jpg> Package pdftex.def Info: pflow.jpg used on input line 98. (pdftex.def) Requested size: 238.25444pt x 122.16223pt. Continued ...... – Sid Apr 29 '20 at 5:30
  • [1{C:/Users/Sid/AppData/Local/MiKTeX/2.9/pdftex/config/pdftex.map} ! pdfTeX error (font expansion): auto expansion is only possible with scalable fonts. \AtBegShi@Output ...ipout \box \AtBeginShipoutBox \fi \fi l.104 ! ==> Fatal error occurred, no output PDF file produced! – Sid Apr 29 '20 at 5:30
  • @Sid Hmmm. The cmss sounds like it’s trying to load a sans-serif from being, which the class file does not set. The example you gave does not do that. You might load a sans-serif font, such as \usepackage{DejaVuSans}. But please post a NWE that reproduces your bug. – Davislor Apr 29 '20 at 6:48
  • adding the \usepackage{DejaVuSans} worked. I really appreciate your help. Thanks. – Sid Apr 29 '20 at 14:01

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.