8

I have trouble generating bibliography in ASME template (https://www.latextemplates.com/template/asme). My packages are standard for Polish:

\usepackage[T1]{fontenc}
\usepackage[polish]{babel}
\usepackage[utf8]{inputenc}

The problem is, I can't generate bibliography. I suppose it's either because of custom class \documentclass[twocolumn,10pt]{asme2ej} or because of custom bibliography style \bibliographystyle{asmems4}, although I've tried regular BiBTeX styles and they don't work. I properly get "Literatura" instead of "References" where bibliography caption should be, it just doesn't generate below and I have numerous [?] in text where [1], [2] etc. should be.

EDIT:
Full reproductible example:

\documentclass[twocolumn,10pt]{asme2ej}

\usepackage[T1]{fontenc}
\usepackage[polish]{babel}
\usepackage[utf8]{inputenc}
\usepackage{epsfig}

\begin{document}

% a lot of text
\cite{Text1}
% a lot of test
\cite{Text2}
% a lot of text

\bibliographystyle{asmems4}
\bibliography{asme2e}

% nothing generates except for "Literatura" caption

\end{document}

Text1 and Text2 are any BiBTeX-legal citations, I use some dummy examples at the moment for testing - changing them doesn't change anything in bibliography.

  • Welcome to TeX.SE! Could you expand your code snippets to a complete example that can be compiled and that shows the issue? That would make it easier to reproduce the problem and o start looking for possible solutions. – Marijn Jun 23 at 21:32
  • I edited my question with full reproductible example. – qalis Jun 23 at 21:38
  • 1
    your example has no \cite commands so naturally has an empty bibliography so can not be used to reproduce the problem at all. Unrelated, it uses epsfig no document should be using that now it is a legacy emulation to mimic a syntax that was popular in the 1980s. – David Carlisle Jun 23 at 22:10
  • "A lot of test" includes a lot of \cite, I'll edit to show that. epsfig - I have no idea about it, it was just in ASME template. – qalis Jun 23 at 22:12
  • I'm afraid the template is not compatible with babel. – egreg Jun 23 at 22:14
4

There is a newer ASME template here: https://ctan.org/pkg/asmejour. Building on egreg's answer, here is a start. Sorry for the mash-up of languages in this example.

% !TEX encoding = UTF-8 Unicode  
\begin{filecontents*}{\jobname.bib}
@article{szczesny,
  author={W. Szcz{\k{e}}sny},
  title={How to save},
  journal={Int. J. Soccer},
  year=2019,
}
@article{piatek,
  author={K. Pi{\k{a}}tek},
  title={How to score},
  journal={Int. J. Soccer},
  year=2019,
}
\end{filecontents*}

\documentclass{asmejour}

\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage[polish]{babel}
\selectlanguage{polish}
\usepackage{lipsum}

\JourName{Heat Transfer}    
\PreprintString{Preprint do recenzji} % <=== this command may not be in TeX Live yet.

\begin{document}

\SetTitle{Tytuł artykułu}   
\keywords{\LaTeX, Polish, ASME}
\SetAuthorBlock{A. Utor}{Institute of Fluid-Flow Machinery \\ Polish Academy of Sciences\\ Gen. J. Fiszcra 14 \\ PL 80-952 Gdańsk, Poland}

\SetAbstract{Abstrakcyjny Język polski, polszczyzna, skrót: pol. – język naturalny należący do grupy języków zachodniosłowiańskich (do której należą również czeski, słowacki, kaszubski, dolnołużycki, górnołużycki i wymarły połabski), stanowiącej część rodziny języków indoeuropejskich. Polszczyzna jest jednym z oficjalnych języków Unii Europejskiej.}

\MakeTitlePage

\section{Wprowadzenie}
\lipsum[1]
\begin{equation}
\mathbf{F}=m\mathbf{a}
\end{equation}    
Język polski \cite{szczesny}. Polszczyzna jest jednym z oficjalnych języków Unii Europejskiej \cite{piatek}.

\bibliographystyle{asmejour}
\bibliography{\jobname}

\end{document}

enter image description here

  • 1
    That's what I was looking for, thank you! – qalis Jun 24 at 7:20
6

I sympathize with people forced to use document classes that are outdated and use funny code that's incompatible with babel.

The class you need falls in this category: for instance advertises usage of epsfig, which has been obsolete for more than 20 years; similarly obsolete is mathptm.

The code contains a modified version of cite.sty, which turns out to fail when babel is loaded. Since the main aim is to compact references, my advice is to load cite and hope for the best.

\begin{filecontents*}{\jobname.bib}
@article{szczesny,
  author={W. Szcz{\k{e}}sny},
  title={How to save},
  journal={Int. J. Soccer},
  year=2019,
}
@article{piatek,
  author={K. Pi{\k{a}}tek},
  title={How to score},
  journal={Int. J. Soccer},
  year=2019,
}
\end{filecontents*}

\documentclass[twocolumn,10pt]{asme2ej}
\usepackage[T1]{fontenc}
%\usepackage[utf8]{inputenc}
\usepackage[polish]{babel}
\usepackage{cite}

\title{Tytuł artykułu}

\author{A. Utor\affiliation{abc}}

\begin{document}

\maketitle    

\begin{abstract}
Abstrakcyjny
\end{abstract}

\section{Wprowadzenie}

\cite{szczesny} and \cite{piatek}

\bibliographystyle{asmems4}

\bibliography{\jobname}

\end{document}

enter image description here

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.