Mercurial > hg > Papers > 2012 > aplas
comparison paper/o2tex @ 34:7294b17518c6
fix o2tex
author | Shinji KONO <kono@ie.u-ryukyu.ac.jp> |
---|---|
date | Sat, 16 Jun 2012 00:17:53 +0900 |
parents | e267a6c473c3 |
children |
comparison
equal
deleted
inserted
replaced
33:bbbda7a58067 | 34:7294b17518c6 |
---|---|
277 $note = 0; | 277 $note = 0; |
278 } | 278 } |
279 for ($depth = 1; substr($_, $depth, 1) eq '-'; $depth++) { | 279 for ($depth = 1; substr($_, $depth, 1) eq '-'; $depth++) { |
280 ; | 280 ; |
281 } | 281 } |
282 if ($depth == 3) { | 282 if ($depth == 2) { |
283 $file = sprintf('%d', $section) . '.tex'; | 283 $file = sprintf('%d', $section) . '.tex'; |
284 &Pick('>>', $file) && | 284 &Pick('>>', $file) && |
285 (print $fh "\\section{", substr($_, $depth, | 285 (print $fh "\\section{", substr($_, $depth, |
286 length($_) - $depth + 1) . '}'); | 286 length($_) - $depth + 1) . '}'); |
287 &Pick('>>', $ohp) && | 287 &Pick('>>', $ohp) && |
293 (printf $fh "\\input{%d}\t%% %s\n", $section, substr($_, | 293 (printf $fh "\\input{%d}\t%% %s\n", $section, substr($_, |
294 $depth, length($_) - $depth + 1)); | 294 $depth, length($_) - $depth + 1)); |
295 $section++; | 295 $section++; |
296 # print STDOUT "$section "; | 296 # print STDOUT "$section "; |
297 } | 297 } |
298 elsif ($depth == 4) { | 298 elsif ($depth == 3) { |
299 $file = sprintf('%d', $section - 1) . '.tex'; | 299 $file = sprintf('%d', $section - 1) . '.tex'; |
300 &Pick('>>', $file) && | 300 &Pick('>>', $file) && |
301 (print $fh "\\subsection{", substr($_, $depth, | 301 (print $fh "\\subsection{", substr($_, $depth, |
302 length($_) - $depth + 1) . '}'); | 302 length($_) - $depth + 1) . '}'); |
303 &Pick('>>', $ohp) && | 303 &Pick('>>', $ohp) && |
304 (print $fh "\\begin{bwslide}"); | 304 (print $fh "\\begin{bwslide}"); |
305 (print $fh "\\ctitle{", substr($_, $depth, | 305 (print $fh "\\ctitle{", substr($_, $depth, |
306 length($_) - $depth + 1) . '}'); | 306 length($_) - $depth + 1) . '}'); |
307 (print $fh "\\end{bwslide}\n\n"); | 307 (print $fh "\\end{bwslide}\n\n"); |
308 } | 308 } |
309 elsif ($depth == 5) { | 309 elsif ($depth == 4) { |
310 $file = sprintf('%d', $section - 1) . '.tex'; | 310 $file = sprintf('%d', $section - 1) . '.tex'; |
311 &Pick('>>', $file) && | 311 &Pick('>>', $file) && |
312 (print $fh "\\subsubsection{", substr($_, $depth, | 312 (print $fh "\\subsubsection{", substr($_, $depth, |
313 length($_) - $depth + 1) . '}'); | 313 length($_) - $depth + 1) . '}'); |
314 &Pick('>>', $ohp) && | 314 &Pick('>>', $ohp) && |
407 print $fh $_; | 407 print $fh $_; |
408 } elsif (!/^-/) { | 408 } elsif (!/^-/) { |
409 &Pick('>>', $file) && | 409 &Pick('>>', $file) && |
410 (print $fh $_); | 410 (print $fh $_); |
411 } | 411 } |
412 if (/\\cite\{/) { $cite = ""; } # } | 412 if (/\\cite\{/) { $cite = ""; } |
413 } | 413 } |
414 } | 414 } |
415 | 415 |
416 foreach $arg (@ARGV) { | 416 foreach $arg (@ARGV) { |
417 open($fdbase,"nkf -e $arg |") || die("$arg cannot open"); | 417 open($fdbase,"nkf -e $arg |") || die("$arg cannot open"); |
473 (print $fh "\\end{titlepage}\n\n"); | 473 (print $fh "\\end{titlepage}\n\n"); |
474 return; | 474 return; |
475 } | 475 } |
476 | 476 |
477 sub Pick { | 477 sub Pick { |
478 local($mode,$name,$pipe) = @_; | 478 my ($mode,$name,$pipe) = @_; |
479 $fh = $opened{$name}; | 479 $fh = $opened{$name}; |
480 if (!$fh) { | 480 if (!$fh) { |
481 $fh = $opened{$name} = 'fh_' . ($nextfh++ + 0); | 481 $fh = $opened{$name} = 'fh_' . ($nextfh++ + 0); |
482 open($fh,$mode.$name.$pipe); | 482 open($fh,$mode.$name.$pipe); |
483 } | 483 } |