0

I'm working in Overleaf, and using the syntax package for Backus-Naur notation, as suggested here. However, it seems to interfere with using the \input command on files with underscores in their names. Here is a minimal working example, where my_file.tex is in the same directory as main.tex.

\documentclass[12pt]{article}
\usepackage[utf8]{inputenc}
\usepackage{syntax}

\begin{document}

\input{my_file} \end{document}

This gives Latex Error: file my@uscore.file not found. The error goes away if I either comment out \usepackge{syntax} or remove the underscore in the file name. I'd rather not have to remove all underscores from file names, because I have a whole naming convention that I always use, across multiple projects. Is there any other way to make this work?

yo'
  • 51,322
ludog
  • 1
  • 2
    the syntax package changes _ to make it active. Additionally, syntax has not been updated since 1996 so might not work well with modern latex. – daleif Feb 21 '22 at 12:04
  • You could use \input{my\string_file} but the package should not be doing that – David Carlisle Feb 21 '22 at 12:22
  • \usepackage[nounderscore]{syntax}, if you really want to use the package. – egreg Feb 21 '22 at 13:39
  • Thanks, all three of these work: [nounderscore], \string and \detokenize. I guess \detokenize might be the best? but they all do the job in my case – ludog Feb 21 '22 at 14:02
  • That other post does answer my question yes. I had a skim before posting here but thought it was different because of the mention of graphicx. – ludog Feb 21 '22 at 14:05

0 Answers0