Take the 2-minute tour ×
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.

I'm trying to modify the inner workings of parcolumns. I'm starting to understand the TeX macro "programming" language a bit but I have some issues.

In paracolumns there are three issues I want to resolve:

  1. Remove vertical space between rows
  2. Remove extra column space at end of column
  3. Make the above optional.

I've narrowed down, I think the problem to the first to the following code:

\vsplit\csname pc@column@\number\count@\endcsname to \dp\strutbox%
\vbox{\unvbox\@tempboxa}%

I've tried everything to remove the space that \vsplit is suppose to add but I get any different results.

Does

\csname pc@column@\number\count@\endcsname to \dp\strutbox%

Create a simple macro name by concatenating pc@column with the value in number and count?


The parcolumns code loops over the columns then the rows. It uses a \repeat and also recursively calls \pc@placeboxes. It has some code to check if the loop is currently at the last column and adds some \hfill. I think it does it ad

\ifnum\count@<\pc@columncount%
\strut\hfill%
\ifpc@rulebetween\vrule\hfill\fi%
\fi%

but commenting all this out doesn't change much if anything. (These are the only lines of code that have \hfill them)


I see

\define@key{parcolumns}{distance}{%
\@tempdimc#1\relax%
}%

Creates a keyvalue pair used in the options. I've tried to duplicate this without luck

\define@key{parcolumns}{extratopspace}{%
\@tempdimq#1\relax%
}%

but I get errors about \tempdimq not existing or whatever. The code looks to simply be assigning \tempdimc to the first argument and I don't see anywhere where \tempdimc is being initalized or created so I figure it is a internal temp variable but then \tempdimq should work(unless there are only a,b,c, and d as I've tried e).


Any ideas or useful comments? One of the biggest issues I have with the code is there is no indentation. Is it ok to indent code or will the whitespace cause problems? BTW, I just stumbled on this reference which seems pretty good:

http://www.tug.org/utilities/plain/cseq.html

share|improve this question
    
There are quite a number of (La)TeX concepts here: David and I have tried to cover some, but individual ones have come up before as questions. –  Joseph Wright May 10 '12 at 8:49
add comment

2 Answers 2

The format of SE works best of you ask one question per post, but anyway

Does

\csname pc@column@\number\count@\endcsname to \dp\strutbox%

Create a simple macro name by concatenating pc@column with the value in number and count?

yes and no: \number is a TeX primitive that returns the decimal expansion of the number stored in the count register so if \count@ is storing 3 and the depth of strutbox is 5pt then the above expands to

\pc@column@3 to 5pt

(although you could only enter it that way of 3 had catcode 11: letter)

but commenting all this out doesn't change much if anything. (These are the only lines of code that have \hfill them)

Presumably (without looking at the package) that is padding between the columns so if your column widths are close to filling the available space there will not be much inter-column space to fill anyway.

I don't see anywhere where `\tempdimc` is being initalized

\tempdim(a b and c) are defined within the LaTeX format as scratch registers. If you need more you need to allocate them.

share|improve this answer
    
Why doesn't \count@ automatically expand like any normal macro? and what is the @ for? e.g., if one removed \number what would happen? –  Uiy May 10 '12 at 14:28
    
\count@ is the name of a register, not a macro, so it does not expand. The @ is part of the name here as it is a 'letter' in this context. –  Joseph Wright May 10 '12 at 14:39
add comment

(Taking some of the parts which David has not)

Whitespace at the start of lines will generally be ignored by TeX as after a new line TeX is 'skipping spaces'. So writing for example

\define@key{parcolumns}{extratopspace}{%
  \@tempdimc#1\relax
}%

is equivalent to writing

\define@key{parcolumns}{extratopspace}{%
\@tempdimc#1\relax
}%

(It's common to use spaces rather than tabs for indenting in TeX code, as tabs are regarded by many TeX users as something of a pain. Two spaces for indenting are pretty common.) You'll notice that I've remove the % after \relax: while % at the end of lines is commonly used to avoid adding extra spaces into code (as TeX converts line ends to a space), one is not needed after a control word such as \relax as TeX is once again skipping spaces here.

David pointed out that \@tempdimc is defined by the LaTeX kernel. It's worth noting that this is a TeX register, not a macro, and hence the assignment takes place by putting thee value after the register name. LaTeX provides us with \setlength as a wrapper around assigning 'lengths' (which are TeX skip registers), but a lot of LaTeX2e programmers simply use the TeX methods directly.

David has explained that

\csname pc@column@\number\count@\endcsname to \dp\strutbox

constructs the name \ps@column@3 if for example \count@ has value 3. It's worth noting that again this is not a macro name but a register name, which you can see as it's assigned in the same way as \@tempdimc and not using \def (which would be the case for a macro).

share|improve this answer
    
What is the @ symbol for? I see it used a lot in register names(and macro names too?) –  Uiy May 10 '12 at 14:29
    
@Uiy See for example tex.stackexchange.com/questions/8351/…. –  Joseph Wright May 10 '12 at 14:35
    
Also see tex.stackexchange.com/questions/6240/… –  Joseph Wright May 10 '12 at 20:15
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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