view paper/md2tex.pl @ 10:d43b107ad199

fix new line encode
author anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
date Thu, 30 Apr 2020 14:23:51 +0900
parents 8f1d03a81516
children dff5f09c28c7
line wrap: on
line source

#!/usr/bin/env perl
use strict;
use warnings;
use utf8;

my $source_md = shift;
my $target_tex = shift;

open my $texFH, '>', $target_tex;

{
  open my $fh, '<', 'md2tex/first.tex';
  while (my $line = <$fh> ) {
    print $texFH $line;
  }
  close $fh;
}

open my $fh, '<', $source_md;
while (my $line = <$fh>) {
  if ($line =~/^#/) {
    $line =~ s/# (.*)/\\section{$1}/;
  }
  print $texFH $line;
}
close $fh;

print $texFH  <<'EOF';

\nocite{*}
\bibliographystyle{ipsjunsrt}
\bibliography{anatofuz-bib}


\end{document}
EOF


close $texFH;