TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

The following code will be referred multiple times in my questions later. Patching is needed to make the frames of both source code and formatted text inside the text width.



  {\typeout{***Successfully patched \protect\SX@codeInput***}}
  {\typeout{***ERROR! Failed to patch \protect\SX@codeInput***}}

    % the following must be defined to make hacking work.
    explpreset={}%must be called even if empty

    Anger is a condition in which the tongue works faster than the mind \ldots




The other 3 questions have been removed and the following one is left to support the answer provided by Herbert. Use edit history button to see the original.

In side-by-side mode (either pos=l or pos=r), how to align the top frames with the same horizontal line?

Herbert's answer plus aboveskip=\dimexpr\fboxsep+\fboxrule\relax will answer this question.

share|improve this question

closed as too localized by Lev Bishop, Seamus, Joseph Wright Aug 11 '11 at 16:36

This question is unlikely to help any future visitors; it is only relevant to a small geographic area, a specific moment in time, or an extraordinarily narrow situation that is not generally applicable to the worldwide audience of the internet. For help making this question more broadly applicable, visit the help center.If this question can be reworded to fit the rules in the help center, please edit the question.

Patching only works when frame=single and pos=b/t. When frame=single and pos=l, the patch does not work because the source code's right edge goes beyond the text width as shown above. – xport Aug 7 '11 at 18:32
up vote 1 down vote accepted

it makes no sense to patch the command as you did. However, getting both on top aligned, insert in the preamble:

share|improve this answer
+1 The patch is necessary when pos=b or pos=t. – xport Aug 7 '11 at 11:20
xleftmargin and xrightmargin are set by explpreset=... and are parameters of listings and no normal length registers – Herbert Aug 7 '11 at 11:29
I need to use aboveskip=\dimexpr\fboxsep+\fboxrule\relax and your code above to align the top frames. – xport Aug 7 '11 at 11:54
Redefining xleftimargin and xrightmargin in explpreset will not help if pos=t/b and frame=single are used. Thus patching is really needed. – xport Aug 7 '11 at 18:18

Not the answer you're looking for? Browse other questions tagged or ask your own question.