Skip to content

Commit

Permalink
Merge pull request #291 from mgage/develop_update1
Browse files Browse the repository at this point in the history
Develop update1
  • Loading branch information
mgage authored Dec 11, 2016
2 parents d92a4e1 + 734c464 commit dc9e378
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 11 deletions.
23 changes: 18 additions & 5 deletions macros/PGbasicmacros.pl
Original file line number Diff line number Diff line change
Expand Up @@ -1236,7 +1236,11 @@ sub SOLUTION {
TEXT( $PAR, knowlLink(SOLUTION_HEADING(), value => escapeSolutionHTML($BR . solution(@_) . $PAR ),
base64 =>1 ) ) if solution(@_);
} elsif ($displayMode=~/TeX/) {
TEXT($PAR,SOLUTION_HEADING(), solution(@_).$PAR) if solution(@_) ;
TEXT(
"\n%%% BEGIN SOLUTION\n", #Marker used in MathBook XML extraction; contact alex.[email protected] before modifying
$PAR,SOLUTION_HEADING(), solution(@_).$PAR,
"\n%%% END SOLUTION\n" #Marker used in MathBook XML extraction; contact [email protected] before modifying
) if solution(@_) ;
} elsif ($displayMode=~/HTML/) {
TEXT( $PAR.SOLUTION_HEADING().$BR.solution(@_).$PAR) if solution(@_) ;
} else {
Expand Down Expand Up @@ -1287,7 +1291,11 @@ sub HINT {
TEXT($PAR, knowlLink(HINT_HEADING(), value=>escapeSolutionHTML($BR . hint(@_) . $PAR ),
base64 => 1) ) if hint(@_);
} elsif ($displayMode=~/TeX/) {
TEXT($PAR,HINT_HEADING(), hint(@_).$PAR) if hint(@_) ;
TEXT(
"\n%%% BEGIN HINT\n", #Marker used in MathBook XML extraction; contact alex.[email protected] before modifying
$PAR,HINT_HEADING(), hint(@_).$PAR,
"\n%%% END HINT\n" #Marker used in MathBook XML extraction; contact [email protected] before modifying
) if hint(@_) ;
} else {
TEXT($PAR, HINT_HEADING(), $BR. hint(@_) . $PAR) if hint(@_);
}
Expand Down Expand Up @@ -2186,19 +2194,24 @@ sub beginproblem {
my $print_path_name_flag =
(defined($effectivePermissionLevel) && defined($PRINT_FILE_NAMES_PERMISSION_LEVEL) && $effectivePermissionLevel >= $PRINT_FILE_NAMES_PERMISSION_LEVEL)
|| ( defined($inlist{ $studentLogin }) and ( $inlist{ $studentLogin }>0 ) )?1:0 ;
$out .= MODES( TeX => '', HTML => '<P style="margin: 0">');
$out .= MODES( TeX =>
"\n%%% BEGIN PROBLEM PREAMBLE\n", #Marker used in MathBook XML extraction; contact [email protected] before modifying
HTML => '<P style="margin: 0">');
if ( $print_path_name_flag ) {
$out .= &M3("{\\bf ${probNum}. {\\footnotesize ($problemValue $points) \\path|$fileName|}}\\newline ",
" \\begin{rawhtml} ($problemValue $points) <B>$l2hFileName</B><BR>\\end{rawhtml}",
"($problemValue $points) <B>$fileName</B><BR>"
) if ($problemValue >=0 and ($envir->{setNumber})=~/\S/ and ($envir->{setNumber}) ne 'Undefined_Set' );
) if ($problemValue >=0 and ($envir->{setNumber})=~/\S/ and ($envir->{setNumber}) ne 'Undefined_Set' and ($envir->{setNumber}) ne 'not defined');
} else {
$out .= &M3("{\\bf ${probNum}.} ($problemValue $points) ",
"($problemValue $points) ",
"($problemValue $points) "
) if ($problemValue >= 0 and ($envir->{setNumber})=~/\S/ and ($envir->{setNumber}) ne 'Undefined_Set');
) if ($problemValue >= 0 and ($envir->{setNumber})=~/\S/ and ($envir->{setNumber}) ne 'Undefined_Set' and ($envir->{setNumber}) ne 'not defined');
}
$out .= MODES(%{main::PG_restricted_eval(q!$main::problemPreamble!)});
$out .= MODES( TeX =>
"\n%%% END PROBLEM PREAMBLE\n", #Marker used in MathBook XML extraction; contact [email protected] before modifying
HTML => "");
$out;

}
Expand Down
13 changes: 7 additions & 6 deletions macros/niceTables.pl
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ =head2 pccTables.pl
# texpre => tex code, # For more fussy cell-by-cell alteration of the tex version of the table
# # TeX code here will precede the cell entry...
# texpost => tex code # and code here will follow the cell entry
# # The ordering will be: tex texpre data texpost
# # The ordering will be: texpre tex data texpost
# texencase => array ref # This is just a shortcut for entering [texpre,texpost] at once.
#
# The "a" in a cell can also be replaced directly with a hash reference {data=>a,options} if somehow that is of use. If you
Expand Down Expand Up @@ -364,7 +364,9 @@ sub DataTable {
if ($htmlalignment[$i] =~ /\|\s*/)
{my $j = $i; while (!defined($alignmentcolumns[$j]) && $j < $#htmlalignment) {$j += 1;};
if ($j < $#htmlalignment) {$columnscss->[$alignmentcolumns[$j]] = "border-left:solid 1px; ".$columnscss->[$alignmentcolumns[$j]];};
if ($alignmentcolumns[$j] != 0) {$columnscss->[$alignmentcolumns[$j]-1] = "border-right:solid 1px; ".$columnscss->[$alignmentcolumns[$j]-1];}
if (defined $alignmentcolumns[$j]) {
if ($alignmentcolumns[$j] != 0) {$columnscss->[$alignmentcolumns[$j]-1] = "border-right:solid 1px; ".$columnscss->[$alignmentcolumns[$j]-1];}
};
if ($j == $#htmlalignment)
{if ($j == $i) {$columnscss->[-1] = "border-right:solid 1px; ".$columnscss->[-1];} else {$columnscss->[-1] = "border-left:solid 1px; ".$columnscss->[-1];}}
};
Expand Down Expand Up @@ -574,16 +576,15 @@ sub DataTable {
{
if ($rowcolor[$i] ne '') {$textable .= '\rowcolor'.$rowcolor[$i];};
for my $j (0..$numcols[$i])
{if (uc(${$dataref->[$i][$j]}{header}) ~~ ['TH','CH','COLUMN','COL','RH','ROW']) {${$dataref->[$i][$j]}{tex} = '\bfseries '.${$dataref->[$i][$j]}{tex}};
{if (uc(${$dataref->[$i][$j]}{header}) ~~ ['TH','CH','COLUMN','COL','RH','ROW'] or ($headerrow[$i] == 1) and !(uc(${$dataref->[$i][$j]}{header}) ~~ ['TD'])) {${$dataref->[$i][$j]}{tex} = '\bfseries '.${$dataref->[$i][$j]}{tex}};
if (${$dataref->[$i][$j]}{multicolumn} ne '') {$textable .= ${$dataref->[$i][$j]}{multicolumn}};
if (($headerrow[$i] == 1) and !(uc(${$dataref->[$i][$j]}{header}) ~~ ['TD'])) {$textable .= '\bfseries '};
$textable .= ${$dataref->[$i][$j]}{tex}.' '.${$dataref->[$i][$j]}{texpre}.' '.${$dataref->[$i][$j]}{data}.' '.${$dataref->[$i][$j]}{texpost};
$textable .= ${$dataref->[$i][$j]}{texpre}.' '.${$dataref->[$i][$j]}{tex}.' '.${$dataref->[$i][$j]}{data}.' '.${$dataref->[$i][$j]}{texpost};
if (${$dataref->[$i][$j]}{multicolumn} ne '') {$textable .= '}'};
$textable .= '&' unless ($j == $numcols[$i]);
};
$textable .= '\\\\';
if ($midrule[$i] == 1) {$textable .= '\midrule '};
if ((($midrules == 1) or ($headerrow[$i] == 1)) and (($i != $#{$dataref}) or ($footerline ne ''))) {$textable .= '\midrule '};
if ((($midrules == 1) or ($headerrow[$i] == 1)) and ($i != $#{$dataref})) {$textable .= '\midrule '};
};
$textable .= '\bottomrule'.$endtabular;
$textable .= '\end{minipage}\par \vspace{1pc}';
Expand Down

0 comments on commit dc9e378

Please sign in to comment.