Skip to content

Commit

Permalink
Don't follow “imports” inside generic macros
Browse files Browse the repository at this point in the history
When we search for bibliography items or labels we also try to include
all files specified via `input` and `include`. We might however also
use `input` and `include` inside generic macros. This could can cause
trouble. For example: Before this commit we would to try to include the
“location” `Code/#1` when searching for cites if we used the following
TeX code:

    \newcommand{\codeinput}[1]
    {
        \begin{leftbar}
            \input{Code/#1}
        \end{leftbar}
    }
  • Loading branch information
sanssecours authored and sorbits committed Sep 25, 2014
1 parent 01c9cb3 commit faa1698
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion Support/lib/LaTeXUtils.rb
Expand Up @@ -189,7 +189,10 @@ def initialize(old_scanner=nil)
# Default values for the +includes+ hash.
def set_defaults
@includes = Hash.new
@includes[/^[^%]*(?:\\include|\\input)\s*\{([^}\\]*)\}/] = Proc.new {|m|
# We ignore inputs and includes containing a hash since these are
# usually used as arguments inside macros e.g. `#1` to access the first
# argument of a macro
@includes[/^[^%]*(?:\\include|\\input)\s*\{([^}\\#]*)\}/] = Proc.new {|m|
m[0].split(",").map do |it|
LaTeX.find_file( it.strip, "tex", File.dirname(@root) ) || raise("Could not locate any file named '#{it}'")
end
Expand Down

0 comments on commit faa1698

Please sign in to comment.