In a flowchart, multiple processes can come together at a sync point, where both processes much reach it before anything can continue. When running a LaTeX file that makes decently heavy use of the log (for debugging purposes), some of my debugging output is intermixed with the list of files being loaded.
Is this to be expected (yes, of course, but why?) and is it possible to force the 'standard output' to flush before my debugging log is put through?
\documentclass{article}
\makeatletter
%%% Begin package propbox
\RequirePackage{xparse}
\RequirePackage{expl3}
\ExplSyntaxOn
\def\propboxdebugmodeon { \def\if_propbox_debug { \iftrue } }
\def\propboxdebugmodeoff { \def\if_propbox_debug { \iffalse } }
\def\propbox_if_debug #1 { \if_propbox_debug #1 \fi }
\def\propbox_debug_msg #1 { \propbox_if_debug { \typeout{#1} } }
%% box collection
%% holds a list of tokens that save boxes
\seq_new:c { propbox_boxes_seq }
%% Property list
%% Comma-separated list of properties
\clist_new:c { propbox_properties_clist }
% inserts #1 into a the sequence with #2's properties
\cs_new_protected:Npn { \g_propbox_new_box } #1 #2 {
% creates a new save box of the name `propbox_boxnames_N' where N is
% the current number of items in the collection---0--\infty.
\tl_set:Nn \l_tmpa_tl { propbox_boxnames_\seq_count:N \propbox_boxes_seq }
\newsavebox { \use:c { \l_tmpa_tl } }
\savebox { \use:c { \l_tmpa_tl } } {
\begin{minipage}{\linewidth}
#2
\end{minipage}
}
\seq_push:Nv { \propbox_boxes_seq } { \use:c { \l_tmpa_tl } }
}
\NewDocumentCommand{\DeclareBoxProperty}{m}{
\propbox_debug_msg { Declaring~new~set~of~box~properties... }
\clist_set:Nn \propbox_properties_clist { #1 }
\propbox_properties_update
\propbox_debug_msg { Complete!~Here~are~the~new~properties: }
\propbox_if_debug { \clist_show:N \propbox_properties_clist }
}
% updates the list of properties a box can have
\cs_new_protected:cpn { propbox_properties_update } {
\propbox_debug_msg { Implementing~new~properties~for~boxes... }
\clist_show:N \propbox_properties_clist
\clist_map_inline:Nn \propbox_properties_clist {
\propbox_debug_msg { Adding~key~'##1' }
\tl_set:Nn \l_tmpa_tl { l_propbox_box_properties__##1 }
\keys_define:nn { propbox / box_properties } {
##1 .tl_set:c = { \l_tmpa_tl }
}
}
\propbox_debug_msg { Done. }
}
\ExplSyntaxOff
\propboxdebugmodeon
\DeclareBoxProperty{id,difficulty}
%%% End package
\makeatother
\propboxdebugmodeon
\begin{document}
\DeclareBoxProperty{hello,goodbye}
\end{document}
and its log output:
This is pdfTeX, Version 3.1415926-2.5-1.40.14 (TeX Live 2013/W32TeX)
restricted \write18 enabled.
entering extended mode
LaTeX2e <2011/06/27>
Babel <3.9f> and hyphenation patterns for 78 languages loaded.
(./test.tex (c:/texlive/2013/texmf-dist/tex/latex/base/article.cls
Document Class: article 2007/10/19 v1.4h Standard LaTeX document class
(c:/texlive/2013/texmf-dist/tex/latex/base/size10.clo))
(c:/texlive/2013/texmf-dist/tex/latex/l3packages/xparse/xparse.sty
(c:/texlive/2013/texmf-dist/tex/latex/l3kernel/expl3.sty
(c:/texlive/2013/texmf-dist/tex/latex/l3kernel/l3names.sty
(c:/texlive/2013/texmf-dist/tex/latex/l3kernel/l3bootstrap.sty))
(c:/texlive/2013/texmf-dist/tex/latex/etex-pkg/etex.sty)
(c:/texlive/2013/texmf-dist/tex/latex/l3kernel/l3basics.sty)
(c:/texlive/2013/texmf-dist/tex/latex/l3kernel/l3expan.sty)
(c:/texlive/2013/texmf-dist/tex/latex/l3kernel/l3tl.sty)
(c:/texlive/2013/texmf-dist/tex/latex/l3kernel/l3seq.sty)
(c:/texlive/2013/texmf-dist/tex/latex/l3kernel/l3int.sty)
(c:/texlive/2013/texmf-dist/tex/latex/l3kernel/l3quark.sty)
(c:/texlive/2013/texmf-dist/tex/latex/l3kernel/l3prg.sty)
(c:/texlive/2013/texmf-dist/tex/latex/l3kernel/l3clist.sty)
(c:/texlive/2013/texmf-dist/tex/latex/l3kernel/l3token.sty)
(c:/texlive/2013/texmf-dist/tex/latex/l3kernel/l3prop.sty)
(c:/texlive/2013/texmf-dist/tex/latex/l3kernel/l3msg.sty)
(c:/texlive/2013/texmf-dist/tex/latex/l3kernel/l3file.sty)
(c:/texlive/2013/texmf-dist/tex/latex/l3kernel/l3skip.sty)
(c:/texlive/2013/texmf-dist/tex/latex/l3kernel/l3keys.sty)
(c:/texlive/2013/texmf-dist/tex/latex/l3kernel/l3fp.sty)
(c:/texlive/2013/texmf-dist/tex/latex/l3kernel/l3box.sty)
(c:/texlive/2013/texmf-dist/tex/latex/l3kernel/l3coffins.sty)
(c:/texlive/2013/texmf-dist/tex/latex/l3kernel/l3color.sty)
(c:/texlive/2013/texmf-dist/tex/latex/l3kernel/l3luatex.sty)
(c:/texlive/2013/texmf-dist/tex/latex/l3kernel/l3candidates.sty)
(c:/texlive/2013/texmf-dist/tex/generic/oberdiek/ifpdf.sty)))
Declaring new set of box properties...
Implementing new properties for boxes...
The comma list \propbox_properties_clist contains the items (without outer
braces):
> {id}
> {difficulty}.
<recently read> }
l.74 \DeclareBoxProperty{id,difficulty}
Adding key 'id'
Adding key 'difficulty'
Done.
Complete! Here are the new properties:
The comma list \propbox_properties_clist contains the items (without outer
braces):
> {id}
> {difficulty}.
<recently read> }
l.74 \DeclareBoxProperty{id,difficulty}
(./test.aux) (c:/texlive/2013/texmf-dist/tex/latex/graphics/graphics.sty
(c:/texlive/2013/texmf-dist/tex/latex/graphics/trig.sty)
(c:/texlive/2013/texmf-dist/tex/latex/latexconfig/graphics.cfg)
(c:/texlive/2013/texmf-dist/tex/latex/pdftex-def/pdftex.def
(c:/texlive/2013/texmf-dist/tex/generic/oberdiek/infwarerr.sty)
(c:/texlive/2013/texmf-dist/tex/generic/oberdiek/ltxcmds.sty)
(c:/texlive/2013/texmf-dist/tex/context/base/supp-pdf.mkii
[Loading MPS to PDF converter (version 2006.09.02).]
))) (c:/texlive/2013/texmf-dist/tex/generic/oberdiek/pdftexcmds.sty
(c:/texlive/2013/texmf-dist/tex/generic/oberdiek/ifluatex.sty))
(c:/texlive/2013/texmf-dist/tex/latex/oberdiek/epstopdf-base.sty
(c:/texlive/2013/texmf-dist/tex/latex/oberdiek/grfext.sty
(c:/texlive/2013/texmf-dist/tex/generic/oberdiek/kvdefinekeys.sty))
(c:/texlive/2013/texmf-dist/tex/latex/oberdiek/kvoptions.sty
(c:/texlive/2013/texmf-dist/tex/latex/graphics/keyval.sty)
(c:/texlive/2013/texmf-dist/tex/generic/oberdiek/kvsetkeys.sty
(c:/texlive/2013/texmf-dist/tex/generic/oberdiek/etexcmds.sty)))
(c:/texlive/2013/texmf-dist/tex/latex/latexconfig/epstopdf-sys.cfg))
Declaring new set of box properties...
Implementing new properties for boxes...
The comma list \propbox_properties_clist contains the items (without outer
braces):
> {hello}
> {goodbye}.
<recently read> }
l.80 \DeclareBoxProperty{hello,goodbye}
Adding key 'hello'
Adding key 'goodbye'
Done.
Complete! Here are the new properties:
The comma list \propbox_properties_clist contains the items (without outer
braces):
> {hello}
> {goodbye}.
<recently read> }
l.80 \DeclareBoxProperty{hello,goodbye}
(./test.aux) )
(see the transcript file for additional information)
No pages of output.
Transcript written on test.log.
LaTeX exited abnormally with code 1 at Sun Aug 11 20:00:50
\begin{document}, as they come after(./test.aux). You could explicitly loadgraphicxbefore doing the first\DeclareBoxProperty, but there's no guarantee that something in\AtBeginDocumentwill generate output. A better strategy is to delimit your debugging information and use something such as Perl for looking at it. – egreg Aug 12 '13 at 08:50