Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Dynare
reporting
Commits
061a46ef
Commit
061a46ef
authored
Jul 25, 2014
by
Houtan Bastani
Browse files
reporting: option to suppress reporting output. closes #688
parent
f869aa5a
Changes
4
Show whitespace changes
Inline
Side-by-side
@report/addPage.m
View file @
061a46ef
...
...
@@ -30,6 +30,8 @@ function o = addPage(o, varargin)
% along with Dynare. If not, see <http://www.gnu.org/licenses/>.
np
=
length
(
o
.
pages
)
+
1
;
fprintf
(
1
,
'Adding Page: %d\n'
,
np
);
if
o
.
showOutput
fprintf
(
1
,
'Adding Page: %d\n'
,
np
);
end
o
.
pages
{
np
}
=
page
(
'orientation'
,
o
.
orientation
,
'paper'
,
o
.
paper
,
varargin
{:});
end
@report/compile.m
View file @
061a46ef
...
...
@@ -32,7 +32,7 @@ function o = compile(o, varargin)
opts
.
compiler
=
o
.
compiler
;
opts
.
showReport
=
true
;
opts
.
showOutput
=
true
;
opts
.
showOutput
=
o
.
showOutput
;
if
nargin
>
1
if
round
((
nargin
-
1
)/
2
)
~=
(
nargin
-
1
)/
2
...
...
@@ -71,15 +71,28 @@ end
if
isempty
(
opts
.
compiler
)
if
strncmp
(
computer
,
'MACI'
,
4
)
||
~
isempty
(
regexpi
(
computer
,
'.*apple.*'
,
'once'
))
% Add most likely places for pdflatex to exist outside of default $PATH
if
opts
.
showOutput
[
status
,
opts
.
compiler
]
=
...
system
([
'PATH=$PATH:/usr/texbin:/usr/local/bin:/usr/local/sbin;'
...
'which pdflatex'
],
echo
);
else
[
status
,
opts
.
compiler
]
=
...
system
(
'PATH=$PATH:/usr/texbin:/usr/local/bin:/usr/local/sbin;which pdflatex'
);
end
elseif
strcmp
(
computer
,
'PCWIN'
)
||
strcmp
(
computer
,
'PCWIN64'
)
if
opts
.
showOutput
[
status
,
opts
.
compiler
]
=
system
(
'findtexmf --file-type=exe pdflatex'
,
echo
);
else
[
status
,
opts
.
compiler
]
=
system
(
'findtexmf --file-type=exe pdflatex'
);
end
middle
=
' '
;
opts
.
compiler
=
[
'"'
strtrim
(
opts
.
compiler
)
'"'
];
else
% gnu/linux
if
opts
.
showOutput
[
status
,
opts
.
compiler
]
=
system
(
'which pdflatex'
,
echo
);
else
[
status
,
opts
.
compiler
]
=
system
(
'which pdflatex'
);
end
end
assert
(
status
==
0
,
...
'@report.compile: Could not find a tex compiler on your system'
);
...
...
@@ -98,10 +111,11 @@ if status ~= 0
error
([
'@report.compile: There was an error in compiling '
rfn
'.pdf.'
...
' '
compiler
' returned the error code: '
num2str
(
status
)]);
end
fprintf
(
1
,
'\n\nDone.\n'
);
disp
(
'Your compiled report is located here:'
);
disp
([
' '
pwd
filesep
rfn
'.pdf'
]);
if
o
.
showOutput
||
opts
.
showOutput
fprintf
(
1
,
'Done.\n'
);
disp
(
'Your compiled report is located here:'
);
disp
([
' '
pwd
filesep
rfn
'.pdf'
]);
end
if
opts
.
showReport
&&
~
isoctave
open
([
pwd
filesep
rfn
'.pdf'
]);
end
...
...
@report/report.m
View file @
061a46ef
...
...
@@ -41,6 +41,7 @@ o.pages = {};
o
.
fileName
=
'report.tex'
;
o
.
showDate
=
true
;
o
.
compiler
=
''
;
o
.
showOutput
=
true
;
if
nargin
==
1
assert
(
isa
(
varargin
{
1
},
'report'
),
[
'@report.report: with one arg, '
...
...
...
@@ -72,6 +73,7 @@ assert(ischar(o.title), '@report.report: title must be a string');
assert
(
ischar
(
o
.
fileName
),
'@report.report: fileName must be a string'
);
assert
(
ischar
(
o
.
compiler
),
'@report.report: compiler file must be a string'
);
assert
(
islogical
(
o
.
showDate
),
'@report.report: showDate must be either true or false'
);
assert
(
islogical
(
o
.
showOutput
),
'@report.report: showOutput must be either true or false'
);
assert
(
isfloat
(
o
.
margin
)
&&
o
.
margin
>
0
,
'@report.report: margin must be a float > 0.'
);
valid_margin_unit
=
{
'cm'
,
'in'
};
...
...
@report/write.m
View file @
061a46ef
...
...
@@ -80,7 +80,9 @@ fprintf(fid, '\\centering\n');
nps
=
length
(
o
.
pages
);
for
i
=
1
:
nps
if
o
.
showOutput
fprintf
(
1
,
'Writing Page: %d\n'
,
i
);
end
o
.
pages
{
i
}
.
write
(
fid
,
i
);
end
...
...
@@ -90,5 +92,7 @@ status = fclose(fid);
if
status
==
-
1
error
(
'@report.write: closing %s\n'
,
o
.
fileName
);
end
disp
(
'Finished Writing Report!'
);
if
o
.
showOutput
disp
(
'Finished Writing Report!'
);
end
end
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment