I've got several documents that I would like to be able to format in different styles depending on the context of the presentation. The content should stay the same, but the formatting may need to change dramatically. I would like to be able store the content in key values to be able to more flexibly organize the formatting.

Here's a relatively minor MWE that nevertheless illustrates the underlying concept:

%% Inner workings which the user should not have to touch                   
%% assuming that I've set this up correctly.                                
  presentation style/.store in=\ae@style,
  name/.store in=\ae@name,
  given/.store in=\ae@given,
  aka/.store in=\ae@aka,
  conclusion/.store in=\ae@conclusion,


  \csname ae@finalize@formatting@\ae@style\endcsname

    \csname ae@build@presentation@\ae@style\endcsname

%% Internal macros for formatting content

%% why do I have to "hide" \midrule like this?

%% User can play with the following macros to change the formatting         
%% of the output.                                                           
%% STYLE="A"                                                                
                           \expandonce\ae@given     \noexpand & 
                           \expandonce\ae@aka       \noexpand & 
                           \expandonce\ae@conclusion }}

    \textsf{Given} & \hspace{3em} & \textsf{Conclusion}

%% STYLE="B"                                                                
      \noexpand\textsf{Conclude:} \expandonce\ae@conclusion

  \end{minipage} \right\}${\large if working with \sffamily\ae@name}\par \vspace{4ex}


  presentation style=A,
      given=Three pairs of sides are congruent,
      conclusion=The two triangles are congruent.},
      given=Two pairs of sides are congruent and 1 pair of included angles is congruent,
      conclusion=The two triangles are congruent,}
      given=Alternate interior angles are congruent,
      conclusion=The  two lines are parallel.},
      given=Same side interior angles are supplementary,
      conclusion=The two lines are parallel.},


When using presentation style=A, the resulting document appears as

enter image description here

When using presentation style=B, the resulting document appears as

enter image description here

This gives me a wide degree of latitude in how I format my document. But my approach seems a bit too convoluted.

Is there a better approach? I would like to stick with pgfkeys. Is there a way in pgfkeys to avoid the nested calls to further key definitions? I tried creating a .style that would accomplish what I wanted but that didn't go anywhere.

On something of tangent to my primary question: I was having problems getting \midrule to behave. I had to bury it inside another macro. Otherwise, even with \noexpand\midrule I got alignment errors. Any ideas?

  • What do you mean by nested calls? Can you point out specifically which part makes you unhappy? – Symbol 1 Nov 20 '16 at 3:21

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.