MacOS: Latexmk junto con Pythontex

MacOS: Latexmk junto con Pythontex

Soy principiante en Latexmk. Pythontex funciona bien al componer con un shell, pero me gustaría probar también con Latexmk.

Lo instalé con TexLive y tengo muchas reglas preinstaladas, incluidas/usr/local/texlive/2019/texmf-dist/doc/support/latexmk/example_rcfiles/pythontex-latexmkrc .

Cuando intento componer conlatexmk -xelatex /Users/jowe_19/Desktop/Finle_Name.tex , la parte de pythontex no funciona.

MWE:

\documentclass[a4paper]{book}
\usepackage{fontspec}
\defaultfontfeatures{Ligatures=TeX}
\usepackage{pythontex}
%%%%%%%%%%%%
\begin{document}

\begin{pyconsole}
print(1)
\end{pyconsole}

\end{document}

REGLA pythontex preinstalada con Mactex:

# Support for pythontex in v. 0.16 or higher, with latexmk 4.62 or higher
#
# What these definitions provide/do:
# 1. Variable specifying command string for invoking pythontex
# 2. Addition to %extra_rule_spec of template for pythontex rule. This
#    tells latexmkrc to create the rule when it is initializing for
#    processing a TeX file.
# 3. A subroutine mypythontex that the pythontex rule is defined to
#    call. This runs pythontex and then sets dependency information.
# 4. Settings for the files generated by the pythontex package and the
#    pythontex program so that the files are deleted in a clean-up
#    operation.

$clean_ext .= " pythontex-files-%R/* pythontex-files-%R";
push @generated_exts, 'pytxcode';

$pythontex = 'pythontex --interpreter python:/Users/jowe_19/opt/miniconda3/bin/python3 %O %S';
$extra_rule_spec{'pythontex'}  = [ 'internal', '', 'mypythontex', "%Y%R.pytxcode",  "%Ypythontex-files-%R/%R.pytxmcr",    "%R", 1 ];

sub mypythontex {
   my $result_dir = $aux_dir1."pythontex-files-$$Pbase";
   my $ret = Run_subst( $pythontex, 2 );
   rdb_add_generated( glob "$result_dir/*" );
   my $fh = new FileHandle $$Pdest, "r";
   if ($fh) {
      while (<$fh>) {
         if ( /^%PythonTeX dependency:\s+'([^']+)';/ ) {
         print "Found pythontex dependency '$1'\n";
             rdb_ensure_file( $rule, $aux_dir1.$1 );
     }
      }
      undef $fh;
   }
   else {
       warn "mypythontex: I could not read '$$Pdest'\n",
            "  to check dependencies\n";
   }
   return $ret;
}

REGISTRO :

Latexmk: This is Latexmk, John Collins, 18 June 2019, version: 4.65.
Latexmk: applying rule 'xelatex'...
Rule 'xelatex': The following rules & subrules became out-of-date:
      'xelatex'
------------
Run number 1 of rule 'xelatex'
------------
------------
Running 'xelatex -no-pdf -recorder  "/Users/jowe_19/Desktop/Test_Latexmk.tex"'
------------
This is XeTeX, Version 3.14159265-2.6-0.999991 (TeX Live 2019) (preloaded format=xelatex)
 restricted \write18 enabled.
entering extended mode
(/Users/jowe_19/Desktop/Test_Latexmk.tex
LaTeX2e <2019-10-01> patch level 3
(/usr/local/texlive/2019/texmf-dist/tex/latex/base/book.cls
Document Class: book 2019/10/25 v1.4k Standard LaTeX document class
(/usr/local/texlive/2019/texmf-dist/tex/latex/base/bk10.clo))
(/usr/local/texlive/2019/texmf-dist/tex/latex/fontspec/fontspec.sty
(/usr/local/texlive/2019/texmf-dist/tex/latex/l3packages/xparse/xparse.sty
(/usr/local/texlive/2019/texmf-dist/tex/latex/l3kernel/expl3.sty
(/usr/local/texlive/2019/texmf-dist/tex/latex/l3kernel/expl3-code.tex
(/usr/local/texlive/2019/texmf-dist/tex/latex/l3kernel/l3deprecation.def))
(/usr/local/texlive/2019/texmf-dist/tex/latex/l3backend/l3backend-xdvipdfmx.def
))) (/usr/local/texlive/2019/texmf-dist/tex/latex/fontspec/fontspec-xetex.sty
(/usr/local/texlive/2019/texmf-dist/tex/latex/base/fontenc.sty
(/usr/local/texlive/2019/texmf-dist/tex/latex/base/tuenc.def))
(/usr/local/texlive/2019/texmf-dist/tex/latex/fontspec/fontspec.cfg)))
(/usr/local/texlive/2019/texmf-dist/tex/latex/pythontex/pythontex.sty
(/usr/local/texlive/2019/texmf-dist/tex/latex/fvextra/fvextra.sty
(/usr/local/texlive/2019/texmf-dist/tex/latex/base/ifthen.sty)
(/usr/local/texlive/2019/texmf-dist/tex/latex/etoolbox/etoolbox.sty)
(/usr/local/texlive/2019/texmf-dist/tex/latex/fancyvrb/fancyvrb.sty
Style option: `fancyvrb' v3.4 <2019/11/09> (tvz)
(/usr/local/texlive/2019/texmf-dist/tex/latex/graphics/keyval.sty))
(/usr/local/texlive/2019/texmf-dist/tex/latex/upquote/upquote.sty
(/usr/local/texlive/2019/texmf-dist/tex/latex/base/textcomp.sty
(/usr/local/texlive/2019/texmf-dist/tex/latex/base/ts1enc.def)))
(/usr/local/texlive/2019/texmf-dist/tex/latex/lineno/lineno.sty))
(/usr/local/texlive/2019/texmf-dist/tex/generic/xstring/xstring.sty
(/usr/local/texlive/2019/texmf-dist/tex/generic/xstring/xstring.tex))
(/usr/local/texlive/2019/texmf-dist/tex/latex/pgfopts/pgfopts.sty
(/usr/local/texlive/2019/texmf-dist/tex/latex/pgf/utilities/pgfkeys.sty
(/usr/local/texlive/2019/texmf-dist/tex/generic/pgf/utilities/pgfkeys.code.tex
(/usr/local/texlive/2019/texmf-dist/tex/generic/pgf/utilities/pgfkeysfiltered.c
ode.tex)))) (/usr/local/texlive/2019/texmf-dist/tex/latex/newfloat/newfloat.sty
) (/usr/local/texlive/2019/texmf-dist/tex/latex/currfile/currfile.sty
(/usr/local/texlive/2019/texmf-dist/tex/latex/kvoptions/kvoptions.sty
(/usr/local/texlive/2019/texmf-dist/tex/generic/ltxcmds/ltxcmds.sty)
(/usr/local/texlive/2019/texmf-dist/tex/generic/kvsetkeys/kvsetkeys.sty))
(/usr/local/texlive/2019/texmf-dist/tex/latex/filehook/filehook.sty)))
(/usr/local/texlive/2019/texmf-dist/tex/latex/xcolor/xcolor.sty
(/usr/local/texlive/2019/texmf-dist/tex/latex/graphics-cfg/color.cfg)
(/usr/local/texlive/2019/texmf-dist/tex/latex/graphics-def/xetex.def))
(./Test_Latexmk.aux)
(/usr/local/texlive/2019/texmf-dist/tex/latex/base/ts1cmr.fd)
No file pythontex-files-Test_Latexmk/Test_Latexmk.pytxmcr.
Run PythonTeX to create it.

Package PythonTeX Warning: Non-existent console content on input line 12.

[1] (./Test_Latexmk.aux) )
(see the transcript file for additional information)
Output written on Test_Latexmk.xdv (1 page, 988 bytes).
Transcript written on Test_Latexmk.log.
=== TeX engine is 'XeTeX'
Latexmk: Missing input file: 'pythontex-files-Test_Latexmk/Test_Latexmk.pytxmcr' from line
  'No file pythontex-files-Test_Latexmk/Test_Latexmk.pytxmcr.'
Latexmk: Log file says output to 'Test_Latexmk.xdv'
Latexmk: applying rule 'xdvipdfmx'...
Rule 'xdvipdfmx': File changes, etc:
   Changed files, or newly in use since previous run(s):
      'Test_Latexmk.xdv'
   Rule(s) that have been run and require run of dependent rule:
      'xelatex' which requires run of 'xdvipdfmx'
------------
Run number 1 of rule 'xdvipdfmx'
------------
For rule 'xdvipdfmx', running '&do_viewfile(  )' ...
------------
Running 'xdvipdfmx -o "Test_Latexmk.pdf"  "Test_Latexmk.xdv"'
------------
Test_Latexmk.xdv -> Test_Latexmk.pdf
[1]
4808 bytes written
Latexmk: All targets () are up-to-date

Respuesta1

Lo que sucedió es que el usuario no puso el código de inicialización en un archivo de inicialización que latexmk leería de forma predeterminada. La solución es poner el código en un archivo que sí se lea. Para obtener información sobre los posibles lugares, consulte la documentación de latexmk en la sección 'ARCHIVOS DE CONFIGURACIÓN/INICIALIZACIÓN (RC)'.

información relacionada