## Context
We currently configure our tex environment to include the template directory in the search path when compiling LaTeX to PDF. We do this in `latexmk.ts:65-71`:

````typescript
  // Resolve any tex input paths
  const texInputDirs: string[] = format.pandoc.template
    ? [`${dirname(format.pandoc.template)}//`]
    : [];
  if (format.render[kLatexInputPaths]) {
    texInputDirs.push(...format.render[kLatexInputPaths]!);
  }
````

This was originally to allow templates to refer to TeX assets and those references to be resolved in the template folder. But we have since introduced `format-resources` and would rather than supporting assets be copied adjacent to the `tex` file so manually compiling the file will work correctly and without additional configuration.

## Issue
If you provide a LaTeX template, and a `tex` file in that LaTeX template's folder (recursively) has the same name as an intermediary file using during PDF compilation, that file will be used. For example, in this directory structure:

```
foo/
  template.qmd
  template.tex
  _extensions/
    my-extension/
      template.tex  <--- this will be used when compiling the PDF! :(
```

If the extension in the above case provides `template.tex` as a LaTeX template, that template will be used instead of the `template.tex` file sitting adjacent to the `qmd` file.


dragonstyle
2022-07-21T00:17:03Z
dragonstyle
v1.1
closed
Incorrect TeX search paths cause erratic behavior with conflicting `.tex` files
https://github.com/quarto-dev/quarto-cli/issues/1474