texstudio
texstudio copied to clipboard
Labels on Figures and Tables aren't working properly
Environment
- TeXstudio: 4.8.7
- Qt: 6.9.0
- OS: Windows 11
- TeX distribution: MikTeX
I just recently had to uninstall TeXStudio and MikTex from my computer due to an error with not compiling the pdf. Before this, everything was working, no issues were happening.
After reinstalling MikTek and TeXStudio, I'm able to compile the pdf but am now getting this weird issue with my labels for tables and figures.
Expected behavior
Here is a the code snippet for my table: \documentclass{pas} \usepackage{threeparttable} \usepackage{graphicx} . . . \begin{document} . . . \begin{table*} \centering \caption{insert caption here, blah, blah, blah}\label{tab:IntObs} \begin{tabular}{ccccc} \hline Date [UT] & Wavelength [$\mu$m] & Baseline & Brackets & Calibrators\ \hline 2015-08-04 & $630-950$~nm & W1-W2 & 4 & HD 218376, HD 225289 \ 2015-08-05 & $630-950$~nm & W1-W2 & 3 & HD 218376, HD 225289, HD 223386 \ 2015-08-08 & $630-950$~nm & E2-W2, W1-W2 & 6 & HD 218376, HD 225289, HD 223386 \ 2015-09-07 & $630-950$~nm & E2-W2 & 4 & HD 218376, HD 225289, HD 223386 \ \hline \end{tabular}
\end{table*}
I expect this code to not have any additional text with it just the table and the caption. For teh ference, I expect it to properly reference the table/figure.
Actual behavior
Upon running this code, I get the following:
where the label is not reading properly. It only reads the \label{t} instead of \label{tab:IntObs} as the label. This is happening for all of my figures and tables. The label command works fine for equations however.
How to reproduce
I'm not sure how to reproduce said error. Someone else did use a different compiler and it worked just fine for them. I also tried a different document style and it worked just fine with that document style. This document style was working with no problem up until a last week.
This is a latex question. Please use tex.stackexchange.com for this.
I wasn't sure if it should go here. Only reason I put it here was because it works in overleaf and texshop.
I struggled a bit with your example. Compilers pdflatex and lualatex worked fine when I used this:
\documentclass{article}
\usepackage{threeparttable}
\begin{document}
\begin{table*}
\centering
\caption{insert caption here, blah, blah, blah}\label{tab:IntObs}
\begin{tabular}{ccccc}
\hline
Date [UT] & Wavelength [$\mu$m] & Baseline & Brackets & Calibrators\\
\hline
2015-08-04 & 630 - 950 ~nm & W1-W2 & 4 & HD 218376, HD 225289 \\
2015-08-05 & 630 - 950 ~nm & W1-W2 & 3 & HD 218376, HD 225289, HD 223386 \\
2015-08-08 & 630 - 950 ~nm & E2-W2, W1-W2 & 6 & HD 218376, HD 225289, HD 223386 \\
2015-09-07 & 630 - 950 ~nm & E2-W2 & 4 & HD 218376, HD 225289, HD 223386 \\
\hline
\end{tabular}
\end{table*}
\end{document}
I had to add the second \ for row endings, the end of the document env and I got error messages for each row regarding a utf symbol that was used as a range indicator between the two wave lengthes in the second column. I replaced them with simple minus signs from the keyboard.