关于 @cabohah 评论的更新

关于 @cabohah 评论的更新

我使用以下文件夹来放置我的sty文件code,其中的tex文件及其资源doc进口商bdoc-fr.tex

rollout
├── build.Lua
├── code
└── doc
    ├── bdoc-fr.tex
    └── examples
        └── ...

这是我的配置build.lua文件。

-- build.lua
module = "bdoc"

sourcefiles = {"code/*.sty"}

typesetfiles     = {"doc/*.tex"}
typesetsuppfiles = {"doc/*/**"}  -- This fails.

checkopts   = "-interaction=nonstopmode --shell-escape"
typesetopts = checkopts

我怎样才能告诉复制里面的文件夹l3build来进行编译?examplesbuild/docbdoc-fr.tex

文件末尾以下log内容确认未找到某些资源文件。

...

! Package minted Error: Missing Pygments output; \inputminted was
probably given a file that does not exist--otherwise, you may need 
the outputdir package option, or may be using an incompatible build tool,
or may be using frozencache with a missing file.

See the minted package documentation for explanation.
Type  H <return>  for immediate help.
 ...                                              
                                                  
l.218 ...nput[code]{examples/showcase/default.tex}
                                                  
This could be caused by using -output-directory or -aux-directory 
without setting minted's outputdir, or by using a build tool that 
changes paths in ways minted cannot detect, 
or using frozencache with a missing file.


! LaTeX Error: File `examples/showcase/default.tex' not found.

Type X to quit or <RETURN> to proceed,
or enter new name. (Default extension: tex)

Enter file name: 
! Emergency stop.
<read *> 
         
l.227     \input{examples/showcase/default.tex}
                                               ^^M
*** (cannot \read from terminal in nonstop modes)

 
Here is how much of TeX's memory you used:
 31212 strings out of 474267
 628168 string characters out of 5750459
 1944555 words of memory out of 5000000
 52913 multiletter control sequences out of 15000+600000
 569174 words of font info for 59 fonts, out of 8000000 for 9000
 1141 hyphenation exceptions out of 8191
 123i,7n,121p,551b,1212s stack positions out of 10000i,1000n,20000p,200000b,200000s
!  ==> Fatal error occurred, no output PDF file produced!

关于 @cabohah 评论的更新

build.lua配置。

module = "bdoc"

sourcefiledir = "code"
sourcefiles   = {"*.sty"}

docfiledir         = "doc"
typesetfiles       = {"*.tex"}
typesetsourcefiles = {"*/**"}

checkopts   = "-interaction=nonstopmode --shell-escape"
typesetopts = checkopts

我的资源文件出现在build/doc但呈扁平结构,不尊重初始树结构,而且确实有文档的一部分,必须进行编译......是否存在一种用于 doc 变量的资源目录?

.
├── ABC.tex
├── bdoc-fr.tex
├── bdoc-locale-english.cfg.sty
├── bdoc-locale-french.cfg.sty
├── bdoc.sty
├── caution.tex
├── customized.tex
└── ...

这是资源文件的初始结构。

.
├── bdoc-fr.tex
└── examples
    ├── focus
    │   ├── caution.tex
    │   └── ...
    ├── listing
    │   ├── ABC.tex
    │   └── ...
    ├── showcase
    │   ├── customized.tex
    │   └── ...
    └── version-n-change
        ├── dating.tex
        └── ...

答案1

如果我们假设所有示例都有可预测的名称,那么无需自定义设置即可完成此操作。例如,我们可能有

docfiledir = "doc"
typesetfiles = {"bdoc-fr.tex"}
typesetdemofiles = {"examples/example*.tex"}

其中所有示例都有可预测的名称。

另一方面,如果你想要完全自由命名,那么生活会变得更加困难,因为主文件和演示(.tex大概都是 类型)之间会发生冲突。在这种情况下,我会使用函数typeset_demo_tasks()来排版演示。例如,我们在 中看到beamer

-- Custom data for the theme demos
themes =
  {
    core = 
      {
        "AnnArbor", "Antibes", "Berkeley", "Berlin", "Bergen", "Boadilla",
        "Copenhagen", "Darmstadt", "Dresden", "EastLansing", "Frankfurt",
        "Goettingen", "Hannover", "Ilmenau", "JuanLesPins", "Luebeck",
        "Malmoe", "Madrid", "Marburg", "Montpellier", "PaloAlto",
        "Pittsburgh", "Rochester", "Singapore", "Szeged", "Warsaw",
        "CambridgeUS", "default", "boxes"
      },
    font = 
      {
        "default", "serif", "structurebold", "structureitalicserif",
        "structuresmallcapsserif"
      },
    color =
      {
        "default", "crane", "albatross", "seahorse", "whale", "dolphin",
        "rose", "orchid", "sidebartab", "lily", "structure", "dove", "seagull",
        "beetle", "fly", "wolverine", "spruce", "beaver", "monarca",
        "albatrossstylish" -- This is a special case: see the .tex file
      },
    outer =
      {
        "default", "infolines", "miniframes", "shadow", "sidebar",
        "smoothbars", "smoothtree", "split", "tree"
      },
    inner = {"default", "circles", "rectangles", "rounded", "inmargin"}
  }

function typeset_demo_tasks()
  local errorlevel = 0
  for type,themelist in pairs(themes) do
    local themetype = ""
    if  type~= "core" then themetype = tostring(type) end
    local name = "beamer" .. themetype .. "themeexample.tex"
    for _,theme in pairs(themelist) do
      print( -- printing current job for easier debugging
        "\nrunning pdflatex \"\\def\\themename{" .. theme .. "}"
          .. "\\input " .. name .. "\" \n"
      )
      errorlevel = errorlevel + runcmd(
        "pdflatex \"\\def\\themename{" .. theme .. "}"
          .. "\\input " .. name .. "\" ",
          typesetdir, {"TEXINPUTS"}
      )
      if errorlevel ~= 0 then
        return errorlevel
      end
      ren(typesetdir,
        string.gsub(name, "%.tex$", ".pdf"),
        "beamerug" .. themetype .. "theme" .. theme .. ".pdf")
    end
  end
  return 0
end

相关内容