How to vertically align the three columns of my table top, top, middleAlign content with the bottom of a tableHow to vertically align multiline columnTable heading too low if on the top of the pageVertically align text to the toptabu package - gaps in vertical linesWhat options are there to globally format tables also allowing local overrides?Table spanning two columns creates too many gapsHow to vertically align text in table ?Change placement of multi-column header
Avoiding racist tropes in fantasy
How should I face my manager if I make a mistake because a senior coworker explained something incorrectly to me?
Science fiction short story where aliens contact a drunk about Earth's impending destruction
Can pay be witheld for hours cleaning up after closing time?
How do I request a longer than normal leave of absence period for my wedding?
Notepad++ - How to find multiple values on the same line in any permutation
Earth rotation discrepancy
Did a flight controller ever answer Flight with a no-go?
How to prevent cutting edges on my TV, HDMI-connected?
Dealing with an extrovert co-worker
Why don't electrons take the shorter path in coils?
Why is less being run unnecessarily by git?
What is the difference between true neutral and unaligned?
Rule based coloured background for labeling in QGIS
Was there ever a treaty between 2 entities with significantly different translations to the detriment of one party?
Checking a beta regression model via glmmTMB with DHARMa package
Why did MS-DOS applications built using Turbo Pascal fail to start with a division by zero error on faster systems?
Mathematical uses of string theory
What is this symbol: semicircles facing eachother
Is "The life is beautiful" incorrect or just very non-idiomatic?
If the first law of thermodynamics ensures conservation of energy, why does it allow systems to lose energy?
Start from ones
How to respectfully refuse to assist co-workers with IT issues?
Why were the crew so desperate to catch Truman and return him to Seahaven?
How to vertically align the three columns of my table top, top, middle
Align content with the bottom of a tableHow to vertically align multiline columnTable heading too low if on the top of the pageVertically align text to the toptabu package - gaps in vertical linesWhat options are there to globally format tables also allowing local overrides?Table spanning two columns creates too many gapsHow to vertically align text in table ?Change placement of multi-column header
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;
I would like the formulae in the third column to be vertically aligned to the middle, i.e. the formulae should be vertically at the middle of the two lines of the descriptions.
documentclassarticle
usepackageamsmath
usepackagetabularx,booktabs
usepackagecaption
begindocument
begintable[htb]
centering
captionI would like the formulae here to be vertically at the middle of the two lines of text
begintabularxlinewidthlX>$c<$
toprule
Name & Description & multicolumn1cFormula\
midrule
Ducks & Something which goes on two lines, something which goes on two lines &
A=dfracBC\
Lions & Something which goes on two lines, something which goes on two lines &
D=dfracEF\
bottomrule
endtabularx
endtable
begintable[htb]
centering
captionHere the formulae are correctly aligned with the description, but I would like the name at the top like in the previous table
begintabularlm24em>$c<$
toprule
Name & Description & multicolumn1cFormula\
midrule
Ducks & Something which goes on two lines, something which goes on two lines &
A=dfracBC\
Lions & Something which goes on two lines, something which goes on two lines &
D=dfracEF\
bottomrule
endtabular
endtable
enddocument
tables vertical-alignment columns
add a comment |
I would like the formulae in the third column to be vertically aligned to the middle, i.e. the formulae should be vertically at the middle of the two lines of the descriptions.
documentclassarticle
usepackageamsmath
usepackagetabularx,booktabs
usepackagecaption
begindocument
begintable[htb]
centering
captionI would like the formulae here to be vertically at the middle of the two lines of text
begintabularxlinewidthlX>$c<$
toprule
Name & Description & multicolumn1cFormula\
midrule
Ducks & Something which goes on two lines, something which goes on two lines &
A=dfracBC\
Lions & Something which goes on two lines, something which goes on two lines &
D=dfracEF\
bottomrule
endtabularx
endtable
begintable[htb]
centering
captionHere the formulae are correctly aligned with the description, but I would like the name at the top like in the previous table
begintabularlm24em>$c<$
toprule
Name & Description & multicolumn1cFormula\
midrule
Ducks & Something which goes on two lines, something which goes on two lines &
A=dfracBC\
Lions & Something which goes on two lines, something which goes on two lines &
D=dfracEF\
bottomrule
endtabular
endtable
enddocument
tables vertical-alignment columns
What do you mean by ‘vertically aligned’? For me, they are.
– Bernard
Aug 10 at 18:12
@Bernard I would like the formulae to be vertically at the middle of the two lines of text
– CarLaTeX
Aug 10 at 18:14
Do you want the first column top-aligned?
– Bernard
Aug 10 at 18:19
@Bernard Yes, exactly!
– CarLaTeX
Aug 10 at 18:20
@Bernard I've edited my question, please see if it's clearer now
– CarLaTeX
Aug 10 at 18:23
add a comment |
I would like the formulae in the third column to be vertically aligned to the middle, i.e. the formulae should be vertically at the middle of the two lines of the descriptions.
documentclassarticle
usepackageamsmath
usepackagetabularx,booktabs
usepackagecaption
begindocument
begintable[htb]
centering
captionI would like the formulae here to be vertically at the middle of the two lines of text
begintabularxlinewidthlX>$c<$
toprule
Name & Description & multicolumn1cFormula\
midrule
Ducks & Something which goes on two lines, something which goes on two lines &
A=dfracBC\
Lions & Something which goes on two lines, something which goes on two lines &
D=dfracEF\
bottomrule
endtabularx
endtable
begintable[htb]
centering
captionHere the formulae are correctly aligned with the description, but I would like the name at the top like in the previous table
begintabularlm24em>$c<$
toprule
Name & Description & multicolumn1cFormula\
midrule
Ducks & Something which goes on two lines, something which goes on two lines &
A=dfracBC\
Lions & Something which goes on two lines, something which goes on two lines &
D=dfracEF\
bottomrule
endtabular
endtable
enddocument
tables vertical-alignment columns
I would like the formulae in the third column to be vertically aligned to the middle, i.e. the formulae should be vertically at the middle of the two lines of the descriptions.
documentclassarticle
usepackageamsmath
usepackagetabularx,booktabs
usepackagecaption
begindocument
begintable[htb]
centering
captionI would like the formulae here to be vertically at the middle of the two lines of text
begintabularxlinewidthlX>$c<$
toprule
Name & Description & multicolumn1cFormula\
midrule
Ducks & Something which goes on two lines, something which goes on two lines &
A=dfracBC\
Lions & Something which goes on two lines, something which goes on two lines &
D=dfracEF\
bottomrule
endtabularx
endtable
begintable[htb]
centering
captionHere the formulae are correctly aligned with the description, but I would like the name at the top like in the previous table
begintabularlm24em>$c<$
toprule
Name & Description & multicolumn1cFormula\
midrule
Ducks & Something which goes on two lines, something which goes on two lines &
A=dfracBC\
Lions & Something which goes on two lines, something which goes on two lines &
D=dfracEF\
bottomrule
endtabular
endtable
enddocument
tables vertical-alignment columns
tables vertical-alignment columns
edited Aug 10 at 18:22
CarLaTeX
asked Aug 10 at 17:49
CarLaTeXCarLaTeX
37.5k5 gold badges61 silver badges166 bronze badges
37.5k5 gold badges61 silver badges166 bronze badges
What do you mean by ‘vertically aligned’? For me, they are.
– Bernard
Aug 10 at 18:12
@Bernard I would like the formulae to be vertically at the middle of the two lines of text
– CarLaTeX
Aug 10 at 18:14
Do you want the first column top-aligned?
– Bernard
Aug 10 at 18:19
@Bernard Yes, exactly!
– CarLaTeX
Aug 10 at 18:20
@Bernard I've edited my question, please see if it's clearer now
– CarLaTeX
Aug 10 at 18:23
add a comment |
What do you mean by ‘vertically aligned’? For me, they are.
– Bernard
Aug 10 at 18:12
@Bernard I would like the formulae to be vertically at the middle of the two lines of text
– CarLaTeX
Aug 10 at 18:14
Do you want the first column top-aligned?
– Bernard
Aug 10 at 18:19
@Bernard Yes, exactly!
– CarLaTeX
Aug 10 at 18:20
@Bernard I've edited my question, please see if it's clearer now
– CarLaTeX
Aug 10 at 18:23
What do you mean by ‘vertically aligned’? For me, they are.
– Bernard
Aug 10 at 18:12
What do you mean by ‘vertically aligned’? For me, they are.
– Bernard
Aug 10 at 18:12
@Bernard I would like the formulae to be vertically at the middle of the two lines of text
– CarLaTeX
Aug 10 at 18:14
@Bernard I would like the formulae to be vertically at the middle of the two lines of text
– CarLaTeX
Aug 10 at 18:14
Do you want the first column top-aligned?
– Bernard
Aug 10 at 18:19
Do you want the first column top-aligned?
– Bernard
Aug 10 at 18:19
@Bernard Yes, exactly!
– CarLaTeX
Aug 10 at 18:20
@Bernard Yes, exactly!
– CarLaTeX
Aug 10 at 18:20
@Bernard I've edited my question, please see if it's clearer now
– CarLaTeX
Aug 10 at 18:23
@Bernard I've edited my question, please see if it's clearer now
– CarLaTeX
Aug 10 at 18:23
add a comment |
4 Answers
4
active
oldest
votes
Here a solution based on the redefinition of the X
column type, and two possible hacks for the first column (they may have to be adapted to the real contents):
documentclassarticle
usepackageamsmath
usepackagetabularx, booktabs, makecell
renewcommandtabularxcolumn[1]m#1
begindocument
begintable[htb]
centering
begintabularxlinewidthlX>$c<$
toprule
Name & Description & multicolumn1cFormula\
midrule
makecell[l]Ducks\mbox & Something which goes on two lines, something which goes on two lines &
A=dfracBC\
addlinespace
makecell[l]Lions\mbox & Something which goes on two lines, something which goes on two lines &
D=dfracEF\
addlinespace
raisebox1.4exLions & Something which goes on two lines, something which goes on two lines &
D=dfracEF\
bottomrule
endtabularx
endtable
enddocument
It not cross my mind to move contents in cell's of the first column +1!
– Zarko
Aug 10 at 19:05
add a third line to one of the cells ...
– Ulrike Fischer
Aug 10 at 20:14
@UlrikeFischer: in theX
column?
– Bernard
Aug 10 at 20:19
yes, naturally there.
– Ulrike Fischer
Aug 10 at 20:20
@UlrikeFischer: it seems to centre theX
column w.r.t. the maths axis of the last column. Don't see what to do in such situations but case by case hacks (dirtier and dirtier!).
– Bernard
Aug 11 at 8:56
|
show 4 more comments
This is rather hard: the problem is that you want to align the middle box in two ways: on the left along the baseline, on the right along the center. This type of table normally requires either nesting of tables (which is difficult with tabularx) or measuring some of the content to use llap tricks.
We are missing here tabular code based on xcoffins which has more than one handle ...
documentclassarticle
usepackageamsmath
usepackagetabularx,booktabs
usepackagecaption,xcoffins
newlengthcolA
begindocument
begintable[htb]
centering
renewcommandtabularxcolumn[1]m#1
settowidthcolAbegintabularlName\Ducks\Lionsendtabular
captionI would like the formulae here to be vertically at the middle of the two lines of text
begintabularxlinewidthpdimexprcolA-2tabcolsepX>$c<$
toprule
Name & Description & multicolumn1cFormula\
midrule
&leavevmodellapmakebox[colA][l]DucksSomething which goes on two lines, something which goes on two lines &
A=dfracBC\
&leavevmodellapmakebox[colA][l]LionsSomething which goes on two lines, something which goes on two lines and on one more line and on one more line and on one more line &
D=dfracEF\
bottomrule
endtabularx
endtable
%Only for show some coffin code:
NewCoffinCoffinA
NewCoffinCoffinB
NewCoffinCoffinC
SetHorizontalCoffinCoffinADucks
SetHorizontalCoffinCoffinC$D=dfracEF$
SetVerticalCoffinCoffinBdimexpr textwidth-CoffinWidthCoffinA-CoffinWidthCoffinC-6tabcolsepnoindent Something which goes on two lines, something which goes on two lines and on one more line and on one more line and on one more line
JoinCoffinsCoffinA[H,r]CoffinB[T,l](2tabcolsep,0pt)
JoinCoffinsCoffinA[vc,r]CoffinC[vc,l](2tabcolsep,0pt)
noindenthspace*tabcolsepTypesetCoffinCoffinA
enddocument
add a comment |
Like this:
Edit:
Position of columns contents are determined by row baseline, which (unfortunately) cannot be changed from column to column.
So far I don't see any other possibility than to use boxes either in the last or the first column, which align their baseline. A good candidate for your particular case is adjustbox
:
documentclassarticle
usepackageamsmath
usepackagetabularx,booktabs
usepackagecaption
usepackageadjustbox
begindocument
begintable[htb]
centering
captionI would like the formulae here to be vertically at the middle of the two lines of text
begintabularxlinewidthlXc
toprule
Name & Description & Formula \
midrule
Ducks & Something which goes on two lines, something which goes on two lines &
adjustboxvalign=t$A=dfracBC$\
Lions & Something which goes on two lines, something which goes on two lines &
adjustboxvalign=t$D=dfracEF$\
bottomrule
endtabularx
endtable
enddocument
For more convenient writing of the table, you can define a new column type:
newcolumntypeE>beginadjustboxvalign=t$c<$endadjustbox
and then write the table (body) as:
begintabularxlinewidthlXE
toprule
Name & Description & Formula \
midrule
Ducks & Something which goes on two lines, something which goes on two lines &
A=dfracBC\
Lions & Something which goes on two lines, something which goes on two lines &
D=dfracEF\
bottomrule
endtabularx
If the text in cells of the middle column has arbitrary number of lines, or if the equation has only one line, the result is worse. In such case a possible solution is the use of multirow
in the first column and manually adjust the number of columns which those cells spans, and in the second column set baseline in vertical middle:
documentclassarticle
usepackageamsmath
usepackagebooktabs, multirow, tabularx
usepackagecaption
usepackageadjustbox
usepackagelipsum
begindocument
begintable[htb]
centering
renewcommandtabularxcolumn[1]m#1 % <---
captionI would like the formulae here to be vertically at the middle of the two lines of text
begintabularxlinewidthlX>$c<$
toprule
Name & Description & Formula \
midrule
multirow-6*Ducks % <--- manually adjusted
& lipsum[66] & A=dfracBC\
bottomrule
endtabularx
endtable
enddocument
or use solution proposed in @Bernard's answer.
1
Quite ingenious! (+1)
– Bernard
Aug 10 at 19:00
Unfortunately, it only appears to work because 1) there are only two lines in the texts of the second column and 2) the formulas have this particular height. Try with eitherlipsum[1]
in the second column or with$A=B$
for either of the formulas. (Yes, the question is a tough one, and I did upvote it.)
– frougon
Aug 10 at 19:11
My actual table is like the mock one, so your solution works. Now I have to decide which one to use (both already upvoted).
– CarLaTeX
Aug 10 at 21:07
1
@CarLaTeX, thank you for editing my answer.Since in the same time i wrote some more explanation and add new example, I will very glad if you correct my answer again. Well, which answer you will choose, is up to you :-).
– Zarko
Aug 10 at 21:14
@Zarko I edited it only because there was "shoved" instead of "showed" :):):) I'm not a native English speaker, so I rarely correct
– CarLaTeX
Aug 10 at 21:17
add a comment |
To have a complete picture of the possibilities, I include a table typeset with the help of cals. It is very easy to have such alignments using a calstable
. I have removed left and right side bearing, which add code, not strictly necessary for creating OP’s table:
documentclassarticle
usepackagecals, caption, amsmath
usepackagelmodern
begindocument
begintable*
captionI would like the formulae here to be vertically at the middle of the two lines of text
begincalstable[c]
% Defining columns relative to each other and relative to the margins
colwidthsdimexpr(columnwidth)/6relax
dimexpr(columnwidth)/6*4relax
dimexpr(columnwidth)/6relax
% Set up the tabular
makeatletter
defcals@framers@width0.8pt % Outside frame rules, reduce if the rule is too heavy
defcals@bodyrs@width0.6pt
defcals@cs@width0pt % Inside rules, reduce if the rule is too heavy
defcals@rs@width0.4pt
defbbifxcals@borderBrelax % Botton border switch (off-on)
defcals@borderB0pt
else letcals@borderBrelaxfi
deflpifdimcals@paddingL=0.0ptrelax % Left padding switch (off-on)
cals@setpaddingAg
else setlengthcals@paddingL0ptfi
defrpifdimcals@paddingR=0.0ptrelax % Right padding switch (off-on)
cals@setpaddingAg
else setlengthcals@paddingR0ptfi
% R1H1
theadsmall%
brow
lpalignLcellNamelp
alignLcellDescription
rpalignRcellFormularp
erow
normalsize%
tfootlastrulestrut
%R2B1
brow
lpbbalignLcellDuckslp
alignLcellSomething which goes on two lines, something which goes on two lines
rpalignRcellvfil$A=dfracBC$rp
erow
%R3B2
brow
bblpalignLcellGnuslp
alignLcellSomething which goes on two lines, something which goes on two lines and on one more line and on one more line and on one more line
rpalignRcellvfil$D=dfracEF$rpbb
erow
%R4B3
brow
lpalignLcellGnatslp
alignLcellSomething which goes on two lines, something which goes on two lines and on one more line and on one more line and on one more line
rpalignRcellvfil $D=dfracEF$rp
erow
makeatletter
endcalstablepar
endtable*
enddocument
add a comment |
Your Answer
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "85"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2ftex.stackexchange.com%2fquestions%2f503692%2fhow-to-vertically-align-the-three-columns-of-my-table-top-top-middle%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
4 Answers
4
active
oldest
votes
4 Answers
4
active
oldest
votes
active
oldest
votes
active
oldest
votes
Here a solution based on the redefinition of the X
column type, and two possible hacks for the first column (they may have to be adapted to the real contents):
documentclassarticle
usepackageamsmath
usepackagetabularx, booktabs, makecell
renewcommandtabularxcolumn[1]m#1
begindocument
begintable[htb]
centering
begintabularxlinewidthlX>$c<$
toprule
Name & Description & multicolumn1cFormula\
midrule
makecell[l]Ducks\mbox & Something which goes on two lines, something which goes on two lines &
A=dfracBC\
addlinespace
makecell[l]Lions\mbox & Something which goes on two lines, something which goes on two lines &
D=dfracEF\
addlinespace
raisebox1.4exLions & Something which goes on two lines, something which goes on two lines &
D=dfracEF\
bottomrule
endtabularx
endtable
enddocument
It not cross my mind to move contents in cell's of the first column +1!
– Zarko
Aug 10 at 19:05
add a third line to one of the cells ...
– Ulrike Fischer
Aug 10 at 20:14
@UlrikeFischer: in theX
column?
– Bernard
Aug 10 at 20:19
yes, naturally there.
– Ulrike Fischer
Aug 10 at 20:20
@UlrikeFischer: it seems to centre theX
column w.r.t. the maths axis of the last column. Don't see what to do in such situations but case by case hacks (dirtier and dirtier!).
– Bernard
Aug 11 at 8:56
|
show 4 more comments
Here a solution based on the redefinition of the X
column type, and two possible hacks for the first column (they may have to be adapted to the real contents):
documentclassarticle
usepackageamsmath
usepackagetabularx, booktabs, makecell
renewcommandtabularxcolumn[1]m#1
begindocument
begintable[htb]
centering
begintabularxlinewidthlX>$c<$
toprule
Name & Description & multicolumn1cFormula\
midrule
makecell[l]Ducks\mbox & Something which goes on two lines, something which goes on two lines &
A=dfracBC\
addlinespace
makecell[l]Lions\mbox & Something which goes on two lines, something which goes on two lines &
D=dfracEF\
addlinespace
raisebox1.4exLions & Something which goes on two lines, something which goes on two lines &
D=dfracEF\
bottomrule
endtabularx
endtable
enddocument
It not cross my mind to move contents in cell's of the first column +1!
– Zarko
Aug 10 at 19:05
add a third line to one of the cells ...
– Ulrike Fischer
Aug 10 at 20:14
@UlrikeFischer: in theX
column?
– Bernard
Aug 10 at 20:19
yes, naturally there.
– Ulrike Fischer
Aug 10 at 20:20
@UlrikeFischer: it seems to centre theX
column w.r.t. the maths axis of the last column. Don't see what to do in such situations but case by case hacks (dirtier and dirtier!).
– Bernard
Aug 11 at 8:56
|
show 4 more comments
Here a solution based on the redefinition of the X
column type, and two possible hacks for the first column (they may have to be adapted to the real contents):
documentclassarticle
usepackageamsmath
usepackagetabularx, booktabs, makecell
renewcommandtabularxcolumn[1]m#1
begindocument
begintable[htb]
centering
begintabularxlinewidthlX>$c<$
toprule
Name & Description & multicolumn1cFormula\
midrule
makecell[l]Ducks\mbox & Something which goes on two lines, something which goes on two lines &
A=dfracBC\
addlinespace
makecell[l]Lions\mbox & Something which goes on two lines, something which goes on two lines &
D=dfracEF\
addlinespace
raisebox1.4exLions & Something which goes on two lines, something which goes on two lines &
D=dfracEF\
bottomrule
endtabularx
endtable
enddocument
Here a solution based on the redefinition of the X
column type, and two possible hacks for the first column (they may have to be adapted to the real contents):
documentclassarticle
usepackageamsmath
usepackagetabularx, booktabs, makecell
renewcommandtabularxcolumn[1]m#1
begindocument
begintable[htb]
centering
begintabularxlinewidthlX>$c<$
toprule
Name & Description & multicolumn1cFormula\
midrule
makecell[l]Ducks\mbox & Something which goes on two lines, something which goes on two lines &
A=dfracBC\
addlinespace
makecell[l]Lions\mbox & Something which goes on two lines, something which goes on two lines &
D=dfracEF\
addlinespace
raisebox1.4exLions & Something which goes on two lines, something which goes on two lines &
D=dfracEF\
bottomrule
endtabularx
endtable
enddocument
edited Aug 10 at 19:01
answered Aug 10 at 18:41
BernardBernard
189k7 gold badges85 silver badges224 bronze badges
189k7 gold badges85 silver badges224 bronze badges
It not cross my mind to move contents in cell's of the first column +1!
– Zarko
Aug 10 at 19:05
add a third line to one of the cells ...
– Ulrike Fischer
Aug 10 at 20:14
@UlrikeFischer: in theX
column?
– Bernard
Aug 10 at 20:19
yes, naturally there.
– Ulrike Fischer
Aug 10 at 20:20
@UlrikeFischer: it seems to centre theX
column w.r.t. the maths axis of the last column. Don't see what to do in such situations but case by case hacks (dirtier and dirtier!).
– Bernard
Aug 11 at 8:56
|
show 4 more comments
It not cross my mind to move contents in cell's of the first column +1!
– Zarko
Aug 10 at 19:05
add a third line to one of the cells ...
– Ulrike Fischer
Aug 10 at 20:14
@UlrikeFischer: in theX
column?
– Bernard
Aug 10 at 20:19
yes, naturally there.
– Ulrike Fischer
Aug 10 at 20:20
@UlrikeFischer: it seems to centre theX
column w.r.t. the maths axis of the last column. Don't see what to do in such situations but case by case hacks (dirtier and dirtier!).
– Bernard
Aug 11 at 8:56
It not cross my mind to move contents in cell's of the first column +1!
– Zarko
Aug 10 at 19:05
It not cross my mind to move contents in cell's of the first column +1!
– Zarko
Aug 10 at 19:05
add a third line to one of the cells ...
– Ulrike Fischer
Aug 10 at 20:14
add a third line to one of the cells ...
– Ulrike Fischer
Aug 10 at 20:14
@UlrikeFischer: in the
X
column?– Bernard
Aug 10 at 20:19
@UlrikeFischer: in the
X
column?– Bernard
Aug 10 at 20:19
yes, naturally there.
– Ulrike Fischer
Aug 10 at 20:20
yes, naturally there.
– Ulrike Fischer
Aug 10 at 20:20
@UlrikeFischer: it seems to centre the
X
column w.r.t. the maths axis of the last column. Don't see what to do in such situations but case by case hacks (dirtier and dirtier!).– Bernard
Aug 11 at 8:56
@UlrikeFischer: it seems to centre the
X
column w.r.t. the maths axis of the last column. Don't see what to do in such situations but case by case hacks (dirtier and dirtier!).– Bernard
Aug 11 at 8:56
|
show 4 more comments
This is rather hard: the problem is that you want to align the middle box in two ways: on the left along the baseline, on the right along the center. This type of table normally requires either nesting of tables (which is difficult with tabularx) or measuring some of the content to use llap tricks.
We are missing here tabular code based on xcoffins which has more than one handle ...
documentclassarticle
usepackageamsmath
usepackagetabularx,booktabs
usepackagecaption,xcoffins
newlengthcolA
begindocument
begintable[htb]
centering
renewcommandtabularxcolumn[1]m#1
settowidthcolAbegintabularlName\Ducks\Lionsendtabular
captionI would like the formulae here to be vertically at the middle of the two lines of text
begintabularxlinewidthpdimexprcolA-2tabcolsepX>$c<$
toprule
Name & Description & multicolumn1cFormula\
midrule
&leavevmodellapmakebox[colA][l]DucksSomething which goes on two lines, something which goes on two lines &
A=dfracBC\
&leavevmodellapmakebox[colA][l]LionsSomething which goes on two lines, something which goes on two lines and on one more line and on one more line and on one more line &
D=dfracEF\
bottomrule
endtabularx
endtable
%Only for show some coffin code:
NewCoffinCoffinA
NewCoffinCoffinB
NewCoffinCoffinC
SetHorizontalCoffinCoffinADucks
SetHorizontalCoffinCoffinC$D=dfracEF$
SetVerticalCoffinCoffinBdimexpr textwidth-CoffinWidthCoffinA-CoffinWidthCoffinC-6tabcolsepnoindent Something which goes on two lines, something which goes on two lines and on one more line and on one more line and on one more line
JoinCoffinsCoffinA[H,r]CoffinB[T,l](2tabcolsep,0pt)
JoinCoffinsCoffinA[vc,r]CoffinC[vc,l](2tabcolsep,0pt)
noindenthspace*tabcolsepTypesetCoffinCoffinA
enddocument
add a comment |
This is rather hard: the problem is that you want to align the middle box in two ways: on the left along the baseline, on the right along the center. This type of table normally requires either nesting of tables (which is difficult with tabularx) or measuring some of the content to use llap tricks.
We are missing here tabular code based on xcoffins which has more than one handle ...
documentclassarticle
usepackageamsmath
usepackagetabularx,booktabs
usepackagecaption,xcoffins
newlengthcolA
begindocument
begintable[htb]
centering
renewcommandtabularxcolumn[1]m#1
settowidthcolAbegintabularlName\Ducks\Lionsendtabular
captionI would like the formulae here to be vertically at the middle of the two lines of text
begintabularxlinewidthpdimexprcolA-2tabcolsepX>$c<$
toprule
Name & Description & multicolumn1cFormula\
midrule
&leavevmodellapmakebox[colA][l]DucksSomething which goes on two lines, something which goes on two lines &
A=dfracBC\
&leavevmodellapmakebox[colA][l]LionsSomething which goes on two lines, something which goes on two lines and on one more line and on one more line and on one more line &
D=dfracEF\
bottomrule
endtabularx
endtable
%Only for show some coffin code:
NewCoffinCoffinA
NewCoffinCoffinB
NewCoffinCoffinC
SetHorizontalCoffinCoffinADucks
SetHorizontalCoffinCoffinC$D=dfracEF$
SetVerticalCoffinCoffinBdimexpr textwidth-CoffinWidthCoffinA-CoffinWidthCoffinC-6tabcolsepnoindent Something which goes on two lines, something which goes on two lines and on one more line and on one more line and on one more line
JoinCoffinsCoffinA[H,r]CoffinB[T,l](2tabcolsep,0pt)
JoinCoffinsCoffinA[vc,r]CoffinC[vc,l](2tabcolsep,0pt)
noindenthspace*tabcolsepTypesetCoffinCoffinA
enddocument
add a comment |
This is rather hard: the problem is that you want to align the middle box in two ways: on the left along the baseline, on the right along the center. This type of table normally requires either nesting of tables (which is difficult with tabularx) or measuring some of the content to use llap tricks.
We are missing here tabular code based on xcoffins which has more than one handle ...
documentclassarticle
usepackageamsmath
usepackagetabularx,booktabs
usepackagecaption,xcoffins
newlengthcolA
begindocument
begintable[htb]
centering
renewcommandtabularxcolumn[1]m#1
settowidthcolAbegintabularlName\Ducks\Lionsendtabular
captionI would like the formulae here to be vertically at the middle of the two lines of text
begintabularxlinewidthpdimexprcolA-2tabcolsepX>$c<$
toprule
Name & Description & multicolumn1cFormula\
midrule
&leavevmodellapmakebox[colA][l]DucksSomething which goes on two lines, something which goes on two lines &
A=dfracBC\
&leavevmodellapmakebox[colA][l]LionsSomething which goes on two lines, something which goes on two lines and on one more line and on one more line and on one more line &
D=dfracEF\
bottomrule
endtabularx
endtable
%Only for show some coffin code:
NewCoffinCoffinA
NewCoffinCoffinB
NewCoffinCoffinC
SetHorizontalCoffinCoffinADucks
SetHorizontalCoffinCoffinC$D=dfracEF$
SetVerticalCoffinCoffinBdimexpr textwidth-CoffinWidthCoffinA-CoffinWidthCoffinC-6tabcolsepnoindent Something which goes on two lines, something which goes on two lines and on one more line and on one more line and on one more line
JoinCoffinsCoffinA[H,r]CoffinB[T,l](2tabcolsep,0pt)
JoinCoffinsCoffinA[vc,r]CoffinC[vc,l](2tabcolsep,0pt)
noindenthspace*tabcolsepTypesetCoffinCoffinA
enddocument
This is rather hard: the problem is that you want to align the middle box in two ways: on the left along the baseline, on the right along the center. This type of table normally requires either nesting of tables (which is difficult with tabularx) or measuring some of the content to use llap tricks.
We are missing here tabular code based on xcoffins which has more than one handle ...
documentclassarticle
usepackageamsmath
usepackagetabularx,booktabs
usepackagecaption,xcoffins
newlengthcolA
begindocument
begintable[htb]
centering
renewcommandtabularxcolumn[1]m#1
settowidthcolAbegintabularlName\Ducks\Lionsendtabular
captionI would like the formulae here to be vertically at the middle of the two lines of text
begintabularxlinewidthpdimexprcolA-2tabcolsepX>$c<$
toprule
Name & Description & multicolumn1cFormula\
midrule
&leavevmodellapmakebox[colA][l]DucksSomething which goes on two lines, something which goes on two lines &
A=dfracBC\
&leavevmodellapmakebox[colA][l]LionsSomething which goes on two lines, something which goes on two lines and on one more line and on one more line and on one more line &
D=dfracEF\
bottomrule
endtabularx
endtable
%Only for show some coffin code:
NewCoffinCoffinA
NewCoffinCoffinB
NewCoffinCoffinC
SetHorizontalCoffinCoffinADucks
SetHorizontalCoffinCoffinC$D=dfracEF$
SetVerticalCoffinCoffinBdimexpr textwidth-CoffinWidthCoffinA-CoffinWidthCoffinC-6tabcolsepnoindent Something which goes on two lines, something which goes on two lines and on one more line and on one more line and on one more line
JoinCoffinsCoffinA[H,r]CoffinB[T,l](2tabcolsep,0pt)
JoinCoffinsCoffinA[vc,r]CoffinC[vc,l](2tabcolsep,0pt)
noindenthspace*tabcolsepTypesetCoffinCoffinA
enddocument
answered Aug 10 at 21:12
Ulrike FischerUlrike Fischer
213k9 gold badges321 silver badges721 bronze badges
213k9 gold badges321 silver badges721 bronze badges
add a comment |
add a comment |
Like this:
Edit:
Position of columns contents are determined by row baseline, which (unfortunately) cannot be changed from column to column.
So far I don't see any other possibility than to use boxes either in the last or the first column, which align their baseline. A good candidate for your particular case is adjustbox
:
documentclassarticle
usepackageamsmath
usepackagetabularx,booktabs
usepackagecaption
usepackageadjustbox
begindocument
begintable[htb]
centering
captionI would like the formulae here to be vertically at the middle of the two lines of text
begintabularxlinewidthlXc
toprule
Name & Description & Formula \
midrule
Ducks & Something which goes on two lines, something which goes on two lines &
adjustboxvalign=t$A=dfracBC$\
Lions & Something which goes on two lines, something which goes on two lines &
adjustboxvalign=t$D=dfracEF$\
bottomrule
endtabularx
endtable
enddocument
For more convenient writing of the table, you can define a new column type:
newcolumntypeE>beginadjustboxvalign=t$c<$endadjustbox
and then write the table (body) as:
begintabularxlinewidthlXE
toprule
Name & Description & Formula \
midrule
Ducks & Something which goes on two lines, something which goes on two lines &
A=dfracBC\
Lions & Something which goes on two lines, something which goes on two lines &
D=dfracEF\
bottomrule
endtabularx
If the text in cells of the middle column has arbitrary number of lines, or if the equation has only one line, the result is worse. In such case a possible solution is the use of multirow
in the first column and manually adjust the number of columns which those cells spans, and in the second column set baseline in vertical middle:
documentclassarticle
usepackageamsmath
usepackagebooktabs, multirow, tabularx
usepackagecaption
usepackageadjustbox
usepackagelipsum
begindocument
begintable[htb]
centering
renewcommandtabularxcolumn[1]m#1 % <---
captionI would like the formulae here to be vertically at the middle of the two lines of text
begintabularxlinewidthlX>$c<$
toprule
Name & Description & Formula \
midrule
multirow-6*Ducks % <--- manually adjusted
& lipsum[66] & A=dfracBC\
bottomrule
endtabularx
endtable
enddocument
or use solution proposed in @Bernard's answer.
1
Quite ingenious! (+1)
– Bernard
Aug 10 at 19:00
Unfortunately, it only appears to work because 1) there are only two lines in the texts of the second column and 2) the formulas have this particular height. Try with eitherlipsum[1]
in the second column or with$A=B$
for either of the formulas. (Yes, the question is a tough one, and I did upvote it.)
– frougon
Aug 10 at 19:11
My actual table is like the mock one, so your solution works. Now I have to decide which one to use (both already upvoted).
– CarLaTeX
Aug 10 at 21:07
1
@CarLaTeX, thank you for editing my answer.Since in the same time i wrote some more explanation and add new example, I will very glad if you correct my answer again. Well, which answer you will choose, is up to you :-).
– Zarko
Aug 10 at 21:14
@Zarko I edited it only because there was "shoved" instead of "showed" :):):) I'm not a native English speaker, so I rarely correct
– CarLaTeX
Aug 10 at 21:17
add a comment |
Like this:
Edit:
Position of columns contents are determined by row baseline, which (unfortunately) cannot be changed from column to column.
So far I don't see any other possibility than to use boxes either in the last or the first column, which align their baseline. A good candidate for your particular case is adjustbox
:
documentclassarticle
usepackageamsmath
usepackagetabularx,booktabs
usepackagecaption
usepackageadjustbox
begindocument
begintable[htb]
centering
captionI would like the formulae here to be vertically at the middle of the two lines of text
begintabularxlinewidthlXc
toprule
Name & Description & Formula \
midrule
Ducks & Something which goes on two lines, something which goes on two lines &
adjustboxvalign=t$A=dfracBC$\
Lions & Something which goes on two lines, something which goes on two lines &
adjustboxvalign=t$D=dfracEF$\
bottomrule
endtabularx
endtable
enddocument
For more convenient writing of the table, you can define a new column type:
newcolumntypeE>beginadjustboxvalign=t$c<$endadjustbox
and then write the table (body) as:
begintabularxlinewidthlXE
toprule
Name & Description & Formula \
midrule
Ducks & Something which goes on two lines, something which goes on two lines &
A=dfracBC\
Lions & Something which goes on two lines, something which goes on two lines &
D=dfracEF\
bottomrule
endtabularx
If the text in cells of the middle column has arbitrary number of lines, or if the equation has only one line, the result is worse. In such case a possible solution is the use of multirow
in the first column and manually adjust the number of columns which those cells spans, and in the second column set baseline in vertical middle:
documentclassarticle
usepackageamsmath
usepackagebooktabs, multirow, tabularx
usepackagecaption
usepackageadjustbox
usepackagelipsum
begindocument
begintable[htb]
centering
renewcommandtabularxcolumn[1]m#1 % <---
captionI would like the formulae here to be vertically at the middle of the two lines of text
begintabularxlinewidthlX>$c<$
toprule
Name & Description & Formula \
midrule
multirow-6*Ducks % <--- manually adjusted
& lipsum[66] & A=dfracBC\
bottomrule
endtabularx
endtable
enddocument
or use solution proposed in @Bernard's answer.
1
Quite ingenious! (+1)
– Bernard
Aug 10 at 19:00
Unfortunately, it only appears to work because 1) there are only two lines in the texts of the second column and 2) the formulas have this particular height. Try with eitherlipsum[1]
in the second column or with$A=B$
for either of the formulas. (Yes, the question is a tough one, and I did upvote it.)
– frougon
Aug 10 at 19:11
My actual table is like the mock one, so your solution works. Now I have to decide which one to use (both already upvoted).
– CarLaTeX
Aug 10 at 21:07
1
@CarLaTeX, thank you for editing my answer.Since in the same time i wrote some more explanation and add new example, I will very glad if you correct my answer again. Well, which answer you will choose, is up to you :-).
– Zarko
Aug 10 at 21:14
@Zarko I edited it only because there was "shoved" instead of "showed" :):):) I'm not a native English speaker, so I rarely correct
– CarLaTeX
Aug 10 at 21:17
add a comment |
Like this:
Edit:
Position of columns contents are determined by row baseline, which (unfortunately) cannot be changed from column to column.
So far I don't see any other possibility than to use boxes either in the last or the first column, which align their baseline. A good candidate for your particular case is adjustbox
:
documentclassarticle
usepackageamsmath
usepackagetabularx,booktabs
usepackagecaption
usepackageadjustbox
begindocument
begintable[htb]
centering
captionI would like the formulae here to be vertically at the middle of the two lines of text
begintabularxlinewidthlXc
toprule
Name & Description & Formula \
midrule
Ducks & Something which goes on two lines, something which goes on two lines &
adjustboxvalign=t$A=dfracBC$\
Lions & Something which goes on two lines, something which goes on two lines &
adjustboxvalign=t$D=dfracEF$\
bottomrule
endtabularx
endtable
enddocument
For more convenient writing of the table, you can define a new column type:
newcolumntypeE>beginadjustboxvalign=t$c<$endadjustbox
and then write the table (body) as:
begintabularxlinewidthlXE
toprule
Name & Description & Formula \
midrule
Ducks & Something which goes on two lines, something which goes on two lines &
A=dfracBC\
Lions & Something which goes on two lines, something which goes on two lines &
D=dfracEF\
bottomrule
endtabularx
If the text in cells of the middle column has arbitrary number of lines, or if the equation has only one line, the result is worse. In such case a possible solution is the use of multirow
in the first column and manually adjust the number of columns which those cells spans, and in the second column set baseline in vertical middle:
documentclassarticle
usepackageamsmath
usepackagebooktabs, multirow, tabularx
usepackagecaption
usepackageadjustbox
usepackagelipsum
begindocument
begintable[htb]
centering
renewcommandtabularxcolumn[1]m#1 % <---
captionI would like the formulae here to be vertically at the middle of the two lines of text
begintabularxlinewidthlX>$c<$
toprule
Name & Description & Formula \
midrule
multirow-6*Ducks % <--- manually adjusted
& lipsum[66] & A=dfracBC\
bottomrule
endtabularx
endtable
enddocument
or use solution proposed in @Bernard's answer.
Like this:
Edit:
Position of columns contents are determined by row baseline, which (unfortunately) cannot be changed from column to column.
So far I don't see any other possibility than to use boxes either in the last or the first column, which align their baseline. A good candidate for your particular case is adjustbox
:
documentclassarticle
usepackageamsmath
usepackagetabularx,booktabs
usepackagecaption
usepackageadjustbox
begindocument
begintable[htb]
centering
captionI would like the formulae here to be vertically at the middle of the two lines of text
begintabularxlinewidthlXc
toprule
Name & Description & Formula \
midrule
Ducks & Something which goes on two lines, something which goes on two lines &
adjustboxvalign=t$A=dfracBC$\
Lions & Something which goes on two lines, something which goes on two lines &
adjustboxvalign=t$D=dfracEF$\
bottomrule
endtabularx
endtable
enddocument
For more convenient writing of the table, you can define a new column type:
newcolumntypeE>beginadjustboxvalign=t$c<$endadjustbox
and then write the table (body) as:
begintabularxlinewidthlXE
toprule
Name & Description & Formula \
midrule
Ducks & Something which goes on two lines, something which goes on two lines &
A=dfracBC\
Lions & Something which goes on two lines, something which goes on two lines &
D=dfracEF\
bottomrule
endtabularx
If the text in cells of the middle column has arbitrary number of lines, or if the equation has only one line, the result is worse. In such case a possible solution is the use of multirow
in the first column and manually adjust the number of columns which those cells spans, and in the second column set baseline in vertical middle:
documentclassarticle
usepackageamsmath
usepackagebooktabs, multirow, tabularx
usepackagecaption
usepackageadjustbox
usepackagelipsum
begindocument
begintable[htb]
centering
renewcommandtabularxcolumn[1]m#1 % <---
captionI would like the formulae here to be vertically at the middle of the two lines of text
begintabularxlinewidthlX>$c<$
toprule
Name & Description & Formula \
midrule
multirow-6*Ducks % <--- manually adjusted
& lipsum[66] & A=dfracBC\
bottomrule
endtabularx
endtable
enddocument
or use solution proposed in @Bernard's answer.
edited Aug 11 at 22:10
Sveinung
13.7k2 gold badges36 silver badges63 bronze badges
13.7k2 gold badges36 silver badges63 bronze badges
answered Aug 10 at 18:44
ZarkoZarko
144k8 gold badges81 silver badges193 bronze badges
144k8 gold badges81 silver badges193 bronze badges
1
Quite ingenious! (+1)
– Bernard
Aug 10 at 19:00
Unfortunately, it only appears to work because 1) there are only two lines in the texts of the second column and 2) the formulas have this particular height. Try with eitherlipsum[1]
in the second column or with$A=B$
for either of the formulas. (Yes, the question is a tough one, and I did upvote it.)
– frougon
Aug 10 at 19:11
My actual table is like the mock one, so your solution works. Now I have to decide which one to use (both already upvoted).
– CarLaTeX
Aug 10 at 21:07
1
@CarLaTeX, thank you for editing my answer.Since in the same time i wrote some more explanation and add new example, I will very glad if you correct my answer again. Well, which answer you will choose, is up to you :-).
– Zarko
Aug 10 at 21:14
@Zarko I edited it only because there was "shoved" instead of "showed" :):):) I'm not a native English speaker, so I rarely correct
– CarLaTeX
Aug 10 at 21:17
add a comment |
1
Quite ingenious! (+1)
– Bernard
Aug 10 at 19:00
Unfortunately, it only appears to work because 1) there are only two lines in the texts of the second column and 2) the formulas have this particular height. Try with eitherlipsum[1]
in the second column or with$A=B$
for either of the formulas. (Yes, the question is a tough one, and I did upvote it.)
– frougon
Aug 10 at 19:11
My actual table is like the mock one, so your solution works. Now I have to decide which one to use (both already upvoted).
– CarLaTeX
Aug 10 at 21:07
1
@CarLaTeX, thank you for editing my answer.Since in the same time i wrote some more explanation and add new example, I will very glad if you correct my answer again. Well, which answer you will choose, is up to you :-).
– Zarko
Aug 10 at 21:14
@Zarko I edited it only because there was "shoved" instead of "showed" :):):) I'm not a native English speaker, so I rarely correct
– CarLaTeX
Aug 10 at 21:17
1
1
Quite ingenious! (+1)
– Bernard
Aug 10 at 19:00
Quite ingenious! (+1)
– Bernard
Aug 10 at 19:00
Unfortunately, it only appears to work because 1) there are only two lines in the texts of the second column and 2) the formulas have this particular height. Try with either
lipsum[1]
in the second column or with $A=B$
for either of the formulas. (Yes, the question is a tough one, and I did upvote it.)– frougon
Aug 10 at 19:11
Unfortunately, it only appears to work because 1) there are only two lines in the texts of the second column and 2) the formulas have this particular height. Try with either
lipsum[1]
in the second column or with $A=B$
for either of the formulas. (Yes, the question is a tough one, and I did upvote it.)– frougon
Aug 10 at 19:11
My actual table is like the mock one, so your solution works. Now I have to decide which one to use (both already upvoted).
– CarLaTeX
Aug 10 at 21:07
My actual table is like the mock one, so your solution works. Now I have to decide which one to use (both already upvoted).
– CarLaTeX
Aug 10 at 21:07
1
1
@CarLaTeX, thank you for editing my answer.Since in the same time i wrote some more explanation and add new example, I will very glad if you correct my answer again. Well, which answer you will choose, is up to you :-).
– Zarko
Aug 10 at 21:14
@CarLaTeX, thank you for editing my answer.Since in the same time i wrote some more explanation and add new example, I will very glad if you correct my answer again. Well, which answer you will choose, is up to you :-).
– Zarko
Aug 10 at 21:14
@Zarko I edited it only because there was "shoved" instead of "showed" :):):) I'm not a native English speaker, so I rarely correct
– CarLaTeX
Aug 10 at 21:17
@Zarko I edited it only because there was "shoved" instead of "showed" :):):) I'm not a native English speaker, so I rarely correct
– CarLaTeX
Aug 10 at 21:17
add a comment |
To have a complete picture of the possibilities, I include a table typeset with the help of cals. It is very easy to have such alignments using a calstable
. I have removed left and right side bearing, which add code, not strictly necessary for creating OP’s table:
documentclassarticle
usepackagecals, caption, amsmath
usepackagelmodern
begindocument
begintable*
captionI would like the formulae here to be vertically at the middle of the two lines of text
begincalstable[c]
% Defining columns relative to each other and relative to the margins
colwidthsdimexpr(columnwidth)/6relax
dimexpr(columnwidth)/6*4relax
dimexpr(columnwidth)/6relax
% Set up the tabular
makeatletter
defcals@framers@width0.8pt % Outside frame rules, reduce if the rule is too heavy
defcals@bodyrs@width0.6pt
defcals@cs@width0pt % Inside rules, reduce if the rule is too heavy
defcals@rs@width0.4pt
defbbifxcals@borderBrelax % Botton border switch (off-on)
defcals@borderB0pt
else letcals@borderBrelaxfi
deflpifdimcals@paddingL=0.0ptrelax % Left padding switch (off-on)
cals@setpaddingAg
else setlengthcals@paddingL0ptfi
defrpifdimcals@paddingR=0.0ptrelax % Right padding switch (off-on)
cals@setpaddingAg
else setlengthcals@paddingR0ptfi
% R1H1
theadsmall%
brow
lpalignLcellNamelp
alignLcellDescription
rpalignRcellFormularp
erow
normalsize%
tfootlastrulestrut
%R2B1
brow
lpbbalignLcellDuckslp
alignLcellSomething which goes on two lines, something which goes on two lines
rpalignRcellvfil$A=dfracBC$rp
erow
%R3B2
brow
bblpalignLcellGnuslp
alignLcellSomething which goes on two lines, something which goes on two lines and on one more line and on one more line and on one more line
rpalignRcellvfil$D=dfracEF$rpbb
erow
%R4B3
brow
lpalignLcellGnatslp
alignLcellSomething which goes on two lines, something which goes on two lines and on one more line and on one more line and on one more line
rpalignRcellvfil $D=dfracEF$rp
erow
makeatletter
endcalstablepar
endtable*
enddocument
add a comment |
To have a complete picture of the possibilities, I include a table typeset with the help of cals. It is very easy to have such alignments using a calstable
. I have removed left and right side bearing, which add code, not strictly necessary for creating OP’s table:
documentclassarticle
usepackagecals, caption, amsmath
usepackagelmodern
begindocument
begintable*
captionI would like the formulae here to be vertically at the middle of the two lines of text
begincalstable[c]
% Defining columns relative to each other and relative to the margins
colwidthsdimexpr(columnwidth)/6relax
dimexpr(columnwidth)/6*4relax
dimexpr(columnwidth)/6relax
% Set up the tabular
makeatletter
defcals@framers@width0.8pt % Outside frame rules, reduce if the rule is too heavy
defcals@bodyrs@width0.6pt
defcals@cs@width0pt % Inside rules, reduce if the rule is too heavy
defcals@rs@width0.4pt
defbbifxcals@borderBrelax % Botton border switch (off-on)
defcals@borderB0pt
else letcals@borderBrelaxfi
deflpifdimcals@paddingL=0.0ptrelax % Left padding switch (off-on)
cals@setpaddingAg
else setlengthcals@paddingL0ptfi
defrpifdimcals@paddingR=0.0ptrelax % Right padding switch (off-on)
cals@setpaddingAg
else setlengthcals@paddingR0ptfi
% R1H1
theadsmall%
brow
lpalignLcellNamelp
alignLcellDescription
rpalignRcellFormularp
erow
normalsize%
tfootlastrulestrut
%R2B1
brow
lpbbalignLcellDuckslp
alignLcellSomething which goes on two lines, something which goes on two lines
rpalignRcellvfil$A=dfracBC$rp
erow
%R3B2
brow
bblpalignLcellGnuslp
alignLcellSomething which goes on two lines, something which goes on two lines and on one more line and on one more line and on one more line
rpalignRcellvfil$D=dfracEF$rpbb
erow
%R4B3
brow
lpalignLcellGnatslp
alignLcellSomething which goes on two lines, something which goes on two lines and on one more line and on one more line and on one more line
rpalignRcellvfil $D=dfracEF$rp
erow
makeatletter
endcalstablepar
endtable*
enddocument
add a comment |
To have a complete picture of the possibilities, I include a table typeset with the help of cals. It is very easy to have such alignments using a calstable
. I have removed left and right side bearing, which add code, not strictly necessary for creating OP’s table:
documentclassarticle
usepackagecals, caption, amsmath
usepackagelmodern
begindocument
begintable*
captionI would like the formulae here to be vertically at the middle of the two lines of text
begincalstable[c]
% Defining columns relative to each other and relative to the margins
colwidthsdimexpr(columnwidth)/6relax
dimexpr(columnwidth)/6*4relax
dimexpr(columnwidth)/6relax
% Set up the tabular
makeatletter
defcals@framers@width0.8pt % Outside frame rules, reduce if the rule is too heavy
defcals@bodyrs@width0.6pt
defcals@cs@width0pt % Inside rules, reduce if the rule is too heavy
defcals@rs@width0.4pt
defbbifxcals@borderBrelax % Botton border switch (off-on)
defcals@borderB0pt
else letcals@borderBrelaxfi
deflpifdimcals@paddingL=0.0ptrelax % Left padding switch (off-on)
cals@setpaddingAg
else setlengthcals@paddingL0ptfi
defrpifdimcals@paddingR=0.0ptrelax % Right padding switch (off-on)
cals@setpaddingAg
else setlengthcals@paddingR0ptfi
% R1H1
theadsmall%
brow
lpalignLcellNamelp
alignLcellDescription
rpalignRcellFormularp
erow
normalsize%
tfootlastrulestrut
%R2B1
brow
lpbbalignLcellDuckslp
alignLcellSomething which goes on two lines, something which goes on two lines
rpalignRcellvfil$A=dfracBC$rp
erow
%R3B2
brow
bblpalignLcellGnuslp
alignLcellSomething which goes on two lines, something which goes on two lines and on one more line and on one more line and on one more line
rpalignRcellvfil$D=dfracEF$rpbb
erow
%R4B3
brow
lpalignLcellGnatslp
alignLcellSomething which goes on two lines, something which goes on two lines and on one more line and on one more line and on one more line
rpalignRcellvfil $D=dfracEF$rp
erow
makeatletter
endcalstablepar
endtable*
enddocument
To have a complete picture of the possibilities, I include a table typeset with the help of cals. It is very easy to have such alignments using a calstable
. I have removed left and right side bearing, which add code, not strictly necessary for creating OP’s table:
documentclassarticle
usepackagecals, caption, amsmath
usepackagelmodern
begindocument
begintable*
captionI would like the formulae here to be vertically at the middle of the two lines of text
begincalstable[c]
% Defining columns relative to each other and relative to the margins
colwidthsdimexpr(columnwidth)/6relax
dimexpr(columnwidth)/6*4relax
dimexpr(columnwidth)/6relax
% Set up the tabular
makeatletter
defcals@framers@width0.8pt % Outside frame rules, reduce if the rule is too heavy
defcals@bodyrs@width0.6pt
defcals@cs@width0pt % Inside rules, reduce if the rule is too heavy
defcals@rs@width0.4pt
defbbifxcals@borderBrelax % Botton border switch (off-on)
defcals@borderB0pt
else letcals@borderBrelaxfi
deflpifdimcals@paddingL=0.0ptrelax % Left padding switch (off-on)
cals@setpaddingAg
else setlengthcals@paddingL0ptfi
defrpifdimcals@paddingR=0.0ptrelax % Right padding switch (off-on)
cals@setpaddingAg
else setlengthcals@paddingR0ptfi
% R1H1
theadsmall%
brow
lpalignLcellNamelp
alignLcellDescription
rpalignRcellFormularp
erow
normalsize%
tfootlastrulestrut
%R2B1
brow
lpbbalignLcellDuckslp
alignLcellSomething which goes on two lines, something which goes on two lines
rpalignRcellvfil$A=dfracBC$rp
erow
%R3B2
brow
bblpalignLcellGnuslp
alignLcellSomething which goes on two lines, something which goes on two lines and on one more line and on one more line and on one more line
rpalignRcellvfil$D=dfracEF$rpbb
erow
%R4B3
brow
lpalignLcellGnatslp
alignLcellSomething which goes on two lines, something which goes on two lines and on one more line and on one more line and on one more line
rpalignRcellvfil $D=dfracEF$rp
erow
makeatletter
endcalstablepar
endtable*
enddocument
answered Aug 12 at 7:20
SveinungSveinung
13.7k2 gold badges36 silver badges63 bronze badges
13.7k2 gold badges36 silver badges63 bronze badges
add a comment |
add a comment |
Thanks for contributing an answer to TeX - LaTeX Stack Exchange!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2ftex.stackexchange.com%2fquestions%2f503692%2fhow-to-vertically-align-the-three-columns-of-my-table-top-top-middle%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
What do you mean by ‘vertically aligned’? For me, they are.
– Bernard
Aug 10 at 18:12
@Bernard I would like the formulae to be vertically at the middle of the two lines of text
– CarLaTeX
Aug 10 at 18:14
Do you want the first column top-aligned?
– Bernard
Aug 10 at 18:19
@Bernard Yes, exactly!
– CarLaTeX
Aug 10 at 18:20
@Bernard I've edited my question, please see if it's clearer now
– CarLaTeX
Aug 10 at 18:23