-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathlatexmkrc
133 lines (116 loc) · 4.13 KB
/
latexmkrc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
@default_files = ('tese');
set_tex_cmds('-synctex=1 -halt-on-error %O %S');
# Nao eh necessario neste modelo, mas pode ser util.
# Veja a secao 5 de "textoc kpathsea" e
# https://www.overleaf.com/learn/latex/Articles/An_introduction_to_Kpathsea_and_how_TeX_engines_search_for_files
#ensure_path('TEXINPUTS', 'conteudo//');
#ensure_path('TEXINPUTS', 'extras//');
#ensure_path('TEXINPUTS', '.');
#ensure_path('BSTINPUTS', 'extras//');
#ensure_path('BSTINPUTS', '.');
# Rodando latexmk a partir do editor atom, texindy falha;
# "2>&1 | tee" é um truque para contornar esse problema
# "-C utf8" ou "-M lang/latin/utf8.xdy" são truques para contornar este
# bug, que existe em outras distribuições tambem:
# https://bugs.launchpad.net/ubuntu/+source/xindy/+bug/1735439
# Se "-C utf8" não funcionar, tente "-M lang/latin/utf8.xdy"
#$makeindex = 'texindy -C utf8 -M hyperxindy.xdy %O -o %D %S 2>&1 | tee';
#$makeindex = 'texindy -M lang/latin/utf8.xdy -M hyperxindy.xdy %O -o %D %S 2>&1 | tee';
$makeindex = 'makeindex -s mkidxhead.ist -l -c %O -o %D %S';
$pdf_mode = 1;
$postscript_mode = $dvi_mode = 0;
$silent = 1; # This adds "-interaction batchmode"
$silence_logfile_warnings = 1;
# Make latexmk -c/-C clean *all* generated files
$cleanup_includes_generated = 1;
$cleanup_includes_cusdep_generated = 1;
$bibtex_use = 2;
# https://tex.stackexchange.com/a/384153/217608
$ENV{max_print_line} = $log_wrap = 100000;
$ENV{error_line} = 254;
$ENV{half_error_line} = 238;
END {
if (-e "$root_filename.blg" and open my $bibfile, '<', "$root_filename.blg") {
print("**********************\n");
print("bibtex/biber messages:\n\n");
my $showed_something = 0;
while(my $line = <$bibfile>) {
if ($line =~ /You.ve used/) {
last;
} elsif ($line =~ /INFO/) {
next;
} else {
print($line);
$showed_something = 1;
};
};
close($bibfile);
if ($showed_something) {
print("\n");
} else {
print("No important messages to show\n\n");
};
};
if (-e "$root_filename.ilg" and open my $indfile, '<', "$root_filename.ilg") {
print("*************************\n");
print("makeindex/xindy messages:\n\n");
my $showed_something = 0;
while(my $line = <$indfile>) {
if ($line =~ /This is makeindex, version/
or $line =~ /Scanning style file/
or $line =~ /Scanning input file/
or $line =~ /Sorting entries/
or $line =~ /Generating output file/
or $line =~ /Output written in/
or $line =~ /Transcript written in/
or $line =~ /done.*accepted.*rejected/
or $line =~ /done.*lines written/
) {
next;
} else {
print($line);
$showed_something = 1;
};
};
close($indfile);
if ($showed_something) {
print("\n");
} else {
print("No important messages to show\n\n");
};
};
if (-e "$root_filename.log") {
print("***************\n");
print("LaTeX messages:\n\n");
my $cmd = "";
my $givenpath = File::Spec->catfile('extras', 'texlogsieve');
if (-s 'texlogsieve') {
$cmd = 'texlua texlogsieve';
} elsif (-s $givenpath) {
$cmd = 'texlua' . ' ' . $givenpath;
} else {
my $nothing = `texlogsieve -h 2>&1`;
if ($? == 0) {
$cmd = 'texlogsieve';
};
};
my $showed_something = 0;
if ($cmd ne "") {
my $conffile = File::Spec->catfile('extras', 'texlogsieverc');
if (-e $conffile) { $cmd = $cmd . ' -c ' . $conffile; };
Run_subst($cmd . ' %R.log');
$showed_something = 1;
} elsif (open my $logfile, '<', "$root_filename.log") {
while (my $line = <$logfile>) {
print($line);
$showed_something = 1;
};
close($logfile);
};
if ($showed_something) {
print("\n");
} else {
print("No important messages to show\n\n");
}
};
};