Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ERR: undefined control sequence \phantomsection #7

Open
henrygrv opened this issue Jul 10, 2022 · 3 comments
Open

ERR: undefined control sequence \phantomsection #7

henrygrv opened this issue Jul 10, 2022 · 3 comments

Comments

@henrygrv
Copy link

when running using the default configuration and starting the preview neovim errors and says:
./<filename>.tex:1: Undefined control sequence \phantomsection when using the hyperref package.

these files compile fine when using my typical tex environment. i have change the engine to xelatex but that has not fixed the problem

@frabjous
Copy link
Owner

It is extraordinarily unlikely that this has anything to do with the plugin. The plugin does not touch the code, and hence cannot have an effect on what errors pdflatex/xelatex, etc., reports.

But I know my way around LaTeX and if you post your code (preferably a minimal working example demonstrating the problem), I'll test it out.

@henrygrv
Copy link
Author

henrygrv commented Jul 12, 2022

\documentclass[]{article}

\usepackage{placeins}
\usepackage{titlesec}
\usepackage[hidelinks, final]{hyperref}
\usepackage{lipsum}


\title{
    Title line 1\\
}
\author{author}
\date{~}
    
\titleformat{\paragraph}[hang]{\small\bfseries}{\theparagraph.}{0.4em}{}
\titleformat{\section}[display]{\centering\bfseries\huge}{}{}{}

\hypersetup{
    colorlinks=false,
    pdftitle={},
    pdfauthor={}
}

\begin{document}
\maketitle
    
\pagebreak

\pdfbookmark{\contentsname}{toc}
\tableofcontents
\newpage

\phantomsection
\addcontentsline{toc}{section}{Analysis}
\section*{Analysis}

\lipsum[1]

\phantomsection
\addcontentsline{toc}{subsection}{Problem Identification}
\subsection*{Problem Identification}

\lipsum[1-3]

\phantomsection
\addcontentsline{toc}{subsubsection}{Validity of a Computational Approach}
\subsubsection*{Validity of a Computational Approach}

\lipsum[1-3]
\FloatBarrier
\end{document}

this works using knap. however in my main tex code base i have multiple source files each being inserted into the main file via \input, could that possibly be the problem?

@frabjous
Copy link
Owner

I can't really diagnose a problem I can't reproduce.

Try making a copy of your project and whittle it down to as minimal a version as possible that still produces the error. If it's caused by using \input, then you can probably get it to happen with a single \input. If you are able to whittle it down to something like that I can take a look, but a sample document that doesn't produce the error doesn't help, I'm afraid.

You may need to describe the directory structure that produces the error.

One thing to keep in mind is that knap runs the processing command from within the folder containing the document root (or the document itself if no root is set), so if you're including relative paths to files in any input or similar commands you'll have to make sure they work relative to that folder.

Does pdflatex/xelatex work from the command line from that folder? What is the other "typical tex environment" that does work?

However, you should really never use paths with \input, but always use the same folder as your document, or use other folders included in kpathsea's tex search path.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants