Graphics, Figures & TablesFile ended while scanning use of \TX@get@body

Information and discussion about graphics, figures & tables in LaTeX documents.
Post Reply
wmcass
Posts: 1
Joined: Mon Aug 01, 2016 4:40 am

File ended while scanning use of \TX@get@body

Post by wmcass »

Hi,

Am using a stata package to output to latex and create tables in a latex package that I am unfamiliar with. Not quite sure what the bug in the outputted latex code (below) is and would appreciate advice.

This generates a "File ended while scanning use of \TX@get@body". I've read through some help, but can't find a solution.

Thanks in advance for help

Code: Select all

Code, edit and compile here:
\documentclass{article}
\usepackage{graphicx}
\usepackage{tabularx}
\usepackage{booktabs}
\usepackage{array}
\begin{document}
\begin{center}
\footnotesize
\newcolumntype{Y}{>{\raggedleft \arraybackslash}X}
\begin{tabularx} {10 cm} {@{} l Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y@{}} \\
\toprule
\cmidrule(l{.75em}){2-4}
\textbf{industry}&\textbf{nonunion}&\textbf{union}&\textbf{Total} \\
\midrule \textbf{Race: white) \\
Ag/Forestry/Fisheries&8&1&9 \\
Mining&2&0&2 \\
Construction&14&2&16 \\
Manufacturing&155&40&195 \\
Transport/Comm/Utility&31&28&59a \\
Wholesale/Retail Trade&188&18&206 \\
Finance/Ins/Real Estate&127&6&133 \\
Business/Repair Svc&41&3&44 \\
Personal Services&33&2&35 \\
Entertainment/Rec Svc&9&2&11 \\
Professional Services&372&160&532 \\
Public Administration&65&37&102 \\
\textbf{Total}&1,045&299&1,344 \\
\midrule \textbf{Race: black} \\
Ag/Forestry/Fisheries&2&1&3 \\
Construction&2&1&3 \\
Manufacturing&76&43&119 \\
Transport/Comm/Utility&8&19&27 \\
Wholesale/Retail Trade&51&3&54 \\
Finance/Ins/Real Estate&16&3&19 \\
Business/Repair Svc&9&4&13 \\
Personal Services&25&3&28 \\
Entertainment/Rec Svc&3&0&3 \\
Professional Services&119&58&177 \\
Public Administration&35&16&51 \\
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

Johannes_B
Site Moderator
Posts: 4182
Joined: Thu Nov 01, 2012 4:08 pm

File ended while scanning use of \TX@get@body

Post by Johannes_B »

An error message like that tells you that TeX is for some reason reading further than it should or needs to. Most often, a closing brace is missing.

In your case, the reason is pretty simple. You have been a bit slopy while typing. \midrule \textbf{Race: white) \\ If we minimalize that further, we get \textbf{) <- All La/TeX finds here is an opening brace and a closing parenthesis that it typesets in bold, but it never sees the closing brace.

Code: Select all

Code, edit and compile here:
\documentclass{article}
\usepackage{graphicx}
\usepackage{tabularx}
\usepackage{booktabs}
\usepackage{array}
\usepackage{ragged2e}
\usepackage{showframe}% Visualize page margins
\usepackage{color}
\newcommand\tabhighlight{\textbf}
\begin{document}
\begin{center}
\footnotesize
\renewcommand\tabhighlight{\bfseries\leavevmode\color{gray!70!black}}% playing around a bit
\newcolumntype{Y}{>{\raggedleft \arraybackslash}X}
\begin{tabularx} {10 cm} { >{\RaggedLeft}p{12em} YYY }
\toprule
\cmidrule(l{.75em}){2-4}
\tabhighlight{industry}&\tabhighlight{nonunion}&\tabhighlight{union}&\tabhighlight{Total} \\
\midrule \tabhighlight{Race: white} \\
Ag/Forestry/Fisheries & 8 & 1 & 9 \\
Mining & 2 & 0 & 2 \\
Construction & 14 & 2 & 16 \\
Manufacturing & 155 & 40 & 195 \\
Transport/Comm/Utility & 31 & 28 & 59a \\
Wholesale/Retail Trade & 188 & 18 & 206 \\
Finance/Ins/Real Estate & 127 & 6 & 133 \\
Business/Repair Svc & 41 & 3 & 44 \\
Personal Services & 33 & 2 & 35 \\
Entertainment/Rec Svc & 9 & 2 & 11 \\
Professional Services & 372 & 160 & 532 \\
Public Administration & 65 & 37 & 102 \\
\tabhighlight{Total} & 1,045 & 299 & 1,344 \\
\midrule \tabhighlight{Race: black} \\
Ag/Forestry/Fisheries & 2 & 1 & 3 \\
Construction & 2 & 1 & 3 \\
Manufacturing & 76 & 43 & 119 \\
Transport/Comm/Utility & 8 & 19 & 27 \\
Wholesale/Retail Trade & 51 & 3 & 54 \\
Finance/Ins/Real Estate & 16 & 3 & 19 \\
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
The smart way: Calm down and take a deep breath, read posts and provided links attentively, try to understand and ask if necessary.
Post Reply