3

This question already has an answer here:

Consider this example:

\documentclass{report}
\usepackage{tabularx}
\usepackage{lipsum}
\begin{document}
\begin{tabularx}{0.5\linewidth}{lX}
A                      &  \lipsum[1][1-2] \\
\end{tabularx}
\end{document}

The output is

enter image description here

How can I centre the contents of cell 00 vertically?

I check the exact code of @ulrike-fischer but I have "A" pushed too much to the bottom: enter image description here

What is wrong? Log-file

    This is pdfTeX, Version 3.14159265-2.6-1.40.19 (TeX Live 2018) (preloaded format=pdflatex 2018.11.18)  21 APR 2019 23:11
entering extended mode
 restricted \write18 enabled.
 %&-line parsing enabled.
**tabularx.tex
(./tabularx.tex
LaTeX2e <2018-04-01> patch level 5
(/usr/local/texlive/2018/texmf-dist/tex/latex/base/report.cls
Document Class: report 2014/09/29 v1.4h Standard LaTeX document class
(/usr/local/texlive/2018/texmf-dist/tex/latex/base/size10.clo
File: size10.clo 2014/09/29 v1.4h Standard LaTeX file (size option)
)
\c@part=\count80
\c@chapter=\count81
\c@section=\count82
\c@subsection=\count83
\c@subsubsection=\count84
\c@paragraph=\count85
\c@subparagraph=\count86
\c@figure=\count87
\c@table=\count88
\abovecaptionskip=\skip41
\belowcaptionskip=\skip42
\bibindent=\dimen102
)
(/usr/local/texlive/2018/texmf-dist/tex/latex/tools/tabularx.sty
Package: tabularx 2016/02/03 v2.11b `tabularx' package (DPC)

(/usr/local/texlive/2018/texmf-dist/tex/latex/tools/array.sty
Package: array 2018/04/30 v2.4h Tabular extension package (FMi)
\col@sep=\dimen103
\ar@mcellbox=\box26
\extrarowheight=\dimen104
\NC@list=\toks14
\extratabsurround=\skip43
\backup@length=\skip44
\ar@cellbox=\box27
)
\TX@col@width=\dimen105
\TX@old@table=\dimen106
\TX@old@col=\dimen107
\TX@target=\dimen108
\TX@delta=\dimen109
\TX@cols=\count89
\TX@ftn=\toks15
)
(/usr/local/texlive/2018/texmf-dist/tex/latex/lipsum/lipsum.sty
(/usr/local/texlive/2018/texmf-dist/tex/latex/l3kernel/expl3.sty
Package: expl3 2018-10-31 L3 programming layer (loader) 

(/usr/local/texlive/2018/texmf-dist/tex/latex/l3kernel/expl3-code.tex
Package: expl3 2018-10-31 L3 programming layer (code)
\c_max_int=\count90
\l_tmpa_int=\count91
\l_tmpb_int=\count92
\g_tmpa_int=\count93
\g_tmpb_int=\count94
\g__kernel_prg_map_int=\count95
\c_log_iow=\count96
\l_iow_line_count_int=\count97
\l__iow_line_target_int=\count98
\l__iow_one_indent_int=\count99
\l__iow_indent_int=\count100
\c_zero_dim=\dimen110
\c_max_dim=\dimen111
\l_tmpa_dim=\dimen112
\l_tmpb_dim=\dimen113
\g_tmpa_dim=\dimen114
\g_tmpb_dim=\dimen115
\c_zero_skip=\skip45
\c_max_skip=\skip46
\l_tmpa_skip=\skip47
\l_tmpb_skip=\skip48
\g_tmpa_skip=\skip49
\g_tmpb_skip=\skip50
\c_zero_muskip=\muskip10
\c_max_muskip=\muskip11
\l_tmpa_muskip=\muskip12
\l_tmpb_muskip=\muskip13
\g_tmpa_muskip=\muskip14
\g_tmpb_muskip=\muskip15
\l_keys_choice_int=\count101
\l__intarray_loop_int=\count102
\c__intarray_sp_dim=\dimen116
\g__intarray_font_int=\count103
\c__fp_leading_shift_int=\count104
\c__fp_middle_shift_int=\count105
\c__fp_trailing_shift_int=\count106
\c__fp_big_leading_shift_int=\count107
\c__fp_big_middle_shift_int=\count108
\c__fp_big_trailing_shift_int=\count109
\c__fp_Bigg_leading_shift_int=\count110
\c__fp_Bigg_middle_shift_int=\count111
\c__fp_Bigg_trailing_shift_int=\count112
\c__kernel_randint_max_int=\count113
\g__fp_array_int=\count114
\l__fp_array_loop_int=\count115
\l__sort_length_int=\count116
\l__sort_min_int=\count117
\l__sort_top_int=\count118
\l__sort_max_int=\count119
\l__sort_true_max_int=\count120
\l__sort_block_int=\count121
\l__sort_begin_int=\count122
\l__sort_end_int=\count123
\l__sort_A_int=\count124
\l__sort_B_int=\count125
\l__sort_C_int=\count126
\l__tl_analysis_normal_int=\count127
\l__tl_analysis_index_int=\count128
\l__tl_analysis_nesting_int=\count129
\l__tl_analysis_type_int=\count130
\l__regex_internal_a_int=\count131
\l__regex_internal_b_int=\count132
\l__regex_internal_c_int=\count133
\l__regex_balance_int=\count134
\l__regex_group_level_int=\count135
\l__regex_mode_int=\count136
\c__regex_cs_in_class_mode_int=\count137
\c__regex_cs_mode_int=\count138
\l__regex_catcodes_int=\count139
\l__regex_default_catcodes_int=\count140
\c__regex_catcode_D_int=\count141
\c__regex_catcode_S_int=\count142
\c__regex_catcode_L_int=\count143
\c__regex_catcode_O_int=\count144
\c__regex_catcode_A_int=\count145
\c__regex_all_catcodes_int=\count146
\l__regex_show_lines_int=\count147
\l__regex_min_state_int=\count148
\l__regex_max_state_int=\count149
\l__regex_left_state_int=\count150
\l__regex_right_state_int=\count151
\l__regex_capturing_group_int=\count152
\l__regex_min_pos_int=\count153
\l__regex_max_pos_int=\count154
\l__regex_curr_pos_int=\count155
\l__regex_start_pos_int=\count156
\l__regex_success_pos_int=\count157
\l__regex_curr_char_int=\count158
\l__regex_curr_catcode_int=\count159
\l__regex_last_char_int=\count160
\l__regex_case_changed_char_int=\count161
\l__regex_curr_state_int=\count162
\l__regex_step_int=\count163
\l__regex_min_active_int=\count164
\l__regex_max_active_int=\count165
\l__regex_replacement_csnames_int=\count166
\l__regex_match_count_int=\count167
\l__regex_min_submatch_int=\count168
\l__regex_submatch_int=\count169
\l__regex_zeroth_submatch_int=\count170
\g__regex_trace_regex_int=\count171
\c_empty_box=\box28
\l_tmpa_box=\box29
\l_tmpb_box=\box30
\g_tmpa_box=\box31
\g_tmpb_box=\box32
\l__box_top_dim=\dimen117
\l__box_bottom_dim=\dimen118
\l__box_left_dim=\dimen119
\l__box_right_dim=\dimen120
\l__box_top_new_dim=\dimen121
\l__box_bottom_new_dim=\dimen122
\l__box_left_new_dim=\dimen123
\l__box_right_new_dim=\dimen124
\l__box_internal_box=\box33
\l__coffin_internal_box=\box34
\l__coffin_internal_dim=\dimen125
\l__coffin_offset_x_dim=\dimen126
\l__coffin_offset_y_dim=\dimen127
\l__coffin_x_dim=\dimen128
\l__coffin_y_dim=\dimen129
\l__coffin_x_prime_dim=\dimen130
\l__coffin_y_prime_dim=\dimen131
\c_empty_coffin=\box35
\l__coffin_aligned_coffin=\box36
\l__coffin_aligned_internal_coffin=\box37
\l_tmpa_coffin=\box38
\l_tmpb_coffin=\box39
\l__coffin_display_coffin=\box40
\l__coffin_display_coord_coffin=\box41
\l__coffin_display_pole_coffin=\box42
\l__coffin_display_offset_dim=\dimen132
\l__coffin_display_x_dim=\dimen133
\l__coffin_display_y_dim=\dimen134
\g__file_internal_ior=\read1
\l__coffin_bounding_shift_dim=\dimen135
\l__coffin_left_corner_dim=\dimen136
\l__coffin_right_corner_dim=\dimen137
\l__coffin_bottom_corner_dim=\dimen138
\l__coffin_top_corner_dim=\dimen139
\l__coffin_scaled_total_height_dim=\dimen140
\l__coffin_scaled_width_dim=\dimen141
\l__seq_internal_a_int=\count172
\l__seq_internal_b_int=\count173
)
(/usr/local/texlive/2018/texmf-dist/tex/latex/l3kernel/l3pdfmode.def
File: l3pdfmode.def 2018-10-31 v L3 Experimental driver: PDF mode
\l__driver_color_stack_int=\count174
))
(/usr/local/texlive/2018/texmf-dist/tex/latex/l3packages/xparse/xparse.sty
Package: xparse 2018-10-17 L3 Experimental document command parser
\l__xparse_current_arg_int=\count175
\g__xparse_grabber_int=\count176
\l__xparse_m_args_int=\count177
\l__xparse_mandatory_args_int=\count178
\l__xparse_v_nesting_int=\count179
)
Package: lipsum 2018/11/07 v2.0 150 paragraphs of Lorem Ipsum dummy text
)
(./tabularx.aux)
\openout1 = `tabularx.aux'.

LaTeX Font Info:    Checking defaults for OML/cmm/m/it on input line 24.
LaTeX Font Info:    ... okay on input line 24.
LaTeX Font Info:    Checking defaults for T1/cmr/m/n on input line 24.
LaTeX Font Info:    ... okay on input line 24.
LaTeX Font Info:    Checking defaults for OT1/cmr/m/n on input line 24.
LaTeX Font Info:    ... okay on input line 24.
LaTeX Font Info:    Checking defaults for OMS/cmsy/m/n on input line 24.
LaTeX Font Info:    ... okay on input line 24.
LaTeX Font Info:    Checking defaults for OMX/cmex/m/n on input line 24.
LaTeX Font Info:    ... okay on input line 24.
LaTeX Font Info:    Checking defaults for U/cmr/m/n on input line 24.
LaTeX Font Info:    ... okay on input line 24.

Underfull \hbox (badness 1442) in paragraph at lines 27--27
[]|\OT1/cmr/m/n/10 Lorem ip-sum do-lor sit amet,
 []

[1

{/usr/local/texlive/2018/texmf-var/fonts/map/pdftex/updmap/pdftex.map}]
(./tabularx.aux) ) 
Here is how much of TeX's memory you used:
 9645 strings out of 492639
 188852 string characters out of 6129286
 478041 words of memory out of 5000000
 13592 multiletter control sequences out of 15000+600000
 532338 words of font info for 24 fonts, out of 8000000 for 9000
 1141 hyphenation exceptions out of 8191
 40i,8n,63p,242b,275s stack positions out of 5000i,500n,10000p,200000b,80000s
</usr/local/texlive/2018/texmf-dist/fonts/type1/public/amsfon
ts/cm/cmr10.pfb>
Output written on tabularx.pdf (1 page, 15036 bytes).
PDF statistics:
 12 PDF objects out of 1000 (max. 8388607)
 7 compressed objects within 1 object stream
 0 named destinations out of 1000 (max. 500000)
 1 words of extra memory for PDF output out of 10000 (max. 10000000)

marked as duplicate by leandriis, Kurt, Phelype Oleinik, Henri Menke, barbara beeton Apr 22 at 3:23

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • Add \renewcommand\tabularxcolumn[1]{m{#1}} to your preamble. – leandriis Apr 21 at 19:56
5
\documentclass{report}
\usepackage{tabularx}
\usepackage{lipsum}
\renewcommand{\tabularxcolumn}[1]{m{#1}}
\begin{document}
\begin{tabularx}{0.5\linewidth}{lX}
A                      &  \lipsum[1][1-2] \\
\end{tabularx}
\end{document}

enter image description here

  • Please see my comment in the question. – Viesturs Apr 21 at 20:05
  • 1
    Well I get the output I showed, show your log-file if yours is different. – Ulrike Fischer Apr 21 at 20:08
  • I inserted the logfile into my question. – Viesturs Apr 21 at 20:12
  • I have newer versions, both of array.sty and lipsum. – Ulrike Fischer Apr 21 at 20:17
  • I update texlive and had the problem fixed. – Viesturs Apr 21 at 21:29
2

Either redefine the X columntype, as shown in the documentation of tabularx, or use multirow, counting the number of lines in the adjacent X cell:

\documentclass{report}
\usepackage{tabularx}
\usepackage{multirow}
\usepackage{lipsum}

\begin{document}

\begin{tabularx}{0.5\linewidth}{lX}
\multirow{4}{*}{A }& \lipsum[1][1-2] \\
\end{tabularx} \bigskip

{\renewcommand{\tabularxcolumn}[1]{m{#1}}
\begin{tabularx}{0.5\linewidth}{lX}
A & \lipsum[1][1-2] \\
\end{tabularx}}

\end{document} 

enter image description here

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