0

I'm getting this error constantly, since setting up a new TexLive instillation with TexStudio on a new laptop. This compiled fine on my desktop, and I'm stuck in knowing what the real root of the issue is.

There are lots of questions that have "File ended while scanning for use of <something>" however each problem seems somewhat independent. I can't see anyone else with <something>="\documentclass".

In my main file, I'm using the subfile package to write different chapters of my document (you can see structure on the LHS). When I try to compile, TexStudio seems to throw a parsing error for interpreting the subfile header.

I dug a bit deeper into the error log as well, and it seems that I'm getting some "Runaway arguments" where there is an additional space at certain points in my compilation. For example, see "R = \frac{h}{q^2}" on the selected line, and then the "runaway argument" error for "R = \frac {h}{q^2}..." (extra space between \frac and arguments).

I take it this spacing mismatch is what is causing my parsing errors. Any idea what is going on? The raw file in the editor looks fine, and compiled fine on my other PC.

enter image description here

6
  • Is your texlive up-to-date? (I don't think that the space is a problem, but subfiles and that you have a path in documentclass. ) Commented Feb 19, 2021 at 7:21
  • @UlrikeFischer Freshly downloaded. V3.1.0 Commented Feb 23, 2021 at 2:37
  • 1
    "3.1.0" is not a version number for texlive. So I guess you have no idea, if your tex system is up-to-date. You have a failing and a working compilation: Compare the two log-files to get a clue what is the problem. Or try to create a small example demonstrating the problem that others can test. Commented Feb 23, 2021 at 8:04
  • Wooops completely misread as Texstudio, apologies. Yes updated distribution using tlmgr. TeX Live 2020. Commented Feb 23, 2021 at 11:45
  • Does the main file also fail to compile or is it only the subfile that shows the errors? Commented Mar 4, 2021 at 18:42

2 Answers 2

1

This error is usually caused by some sort of unclosed structure, i.e., a missing } or an unclosed environment of some sort.

Happens to me quite a lot when writing complex presentations in beamer. Solution is to narrow down the start (perhaps by perusing the *.log file, peeking at whatever partial output file you get), and ruthlessly commenting out/deleting parts of the file until you isolate the problem to a short stretch, and then do a binary search if you can't see the problem.

A LaTeX-aware editor (I use emacs with AUC-TeX) helps if you ask to (re)indent a section of the code, many errors will manifest as weird indentations.

0

According to the subfiles documentation, you should use

\documentclass[<main_file_name>]{subfiles} \begin{document} .... \end{document} 

This must have updated since a previous version I was using probably prior to 2020, where I didn't need \begin \end commands. Simple fix in the end.

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.