Hi, I'm definitely looking for "superscript comma" rather than an apostrophe. It is commonly used in the authorship list for publications. We have hundreds of scientists with different affiliations, I want to use script to generate them instead of manually type them one by one. Now, I'm using PERL script to read from ".csv" and write to a ".rtf" file. Something like the author list in the following article: http://www.nature.com/nature/journal/v496/n7443/pdf/nature12031.pdf Sorry, I don't know how to upload a picture. If you cannot open this article, please let me know you email address and I can send it to you. I also attached my script here, hope someone can help me. Thanks very much.
#!/usr/bin/perl -w use strict; use warnings; use RTF::Writer; use Unicode::Subscript ':all'; use Text::CSV; #use Unicode::Subscript qw(subscript superscript); if(@ARGV != 2) { print STDERR "Usage: authorship_APP.pl input(.csv) output(.rtf)\n" +; exit(0); } my ($inf, $outf)=@ARGV; my $all_affi; my %hash; my @all_name; my $count=1; my @rows; my $csv = Text::CSV->new ( { binary => 1 } ) # should set binary attr +ibute. or die "Cannot use CSV: ".Text::CSV->error_diag (); open my $fh, "<", $inf or die "$inf: $!"; while ( my $row = $csv->getline( $fh ) ) { if($row->[0]=~/^\d/){ my @a_num; for(my $i=3; $i<=7; $i++){ if($row->[$i]=~/\w/){ my $tmp=$row->[$i]; if(! exists $hash{$tmp}){ $hash{$tmp}=$count; push(@a_num, $hash{$tmp}); $all_affi.=$count.$tmp."\. "; $count++; } }else{ last; } } my $a_num=join"\+", @a_num; if($row->[2]=~/\w/){ push(@all_name, "$row->[1] $row->[2]".superscript($a_num)) +; }elsif($row->[1]=~/\w/){ push(@all_name, "$row->[1]".superscript($a_num)); }else{ print STDERR "Error! Wrong first name for this row:\n$row\ +n"; exit; } } } $csv->eof or $csv->error_diag(); close $fh; my $all_name=join", ", @all_name; print STDERR "There are ". scalar(@all_name)." authors and ".scalar(ke +ys %hash)." affiliations in this list.\n"; my $final= "$all_name\n\n$all_affi\n"; #my $test='This algorithm is O(n' . superscript(3) . ')'; my $rtf = RTF::Writer->new_to_file($outf); $rtf->prolog( 'title' => "Greetings, Naomi" ); $rtf->number_pages; $rtf->paragraph( $final ); $rtf->close;

In reply to Re^2: print comma in superscript by qingfengzealot
in thread print comma in superscript by qingfengzealot

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.