3

I'm newbie in TeX, so I've decided to ask for some help.

I'm working on technical documentation for my job and I need to create a 4-column table, where text in first two columns top-aligned and centered horizontally, last two aligned with last string of second column. But I can't achieve this.

I've tried this: Align text at the bottom of the table cell

and this: Vertical alignment in tabular cells with variable height

But the closest result which I able to obtain is:

enter image description here

So, last three columns is OK, first one - not, it should be top-aligned.

I was successful to overcome this by usage of \multirow environment, but it's should be implemented individually to rows. If' I'll do this for long tables - it'll make me insane. I want one fixed style in preamble, if it's possible.

Here is my table in main body:

    %russian technichal standart documentation class
     \documentclass[russian, 14pt, utf8, columnsxxiv, columnxxxi, columnxxxii, pointsection, hpadding = 10mm]{eskdtext}

     %%%For working of eskdx, also cyrillic
     \usepackage{xecyr}

     %%%set TNR as main font
     \setmainfont[Mapping=tex-text]{Times New Roman}

     %%%Additional position options
     \usepackage{float}

     %%%advanced tables
     \usepackage{tabularx}
     \newcolumntype{Y}{>{\centering\arraybackslash}X}      
     \newcolumntype{d}{>{\centering}b{.25\textwidth}}
     \newcolumntype{s}{>{\centering}b{.1\textwidth}}
     \newcolumntype{a}{>{\centering}p{.25\textwidth}}

     %%%redefine command for № -symbol, because eskdx quite old package
     \renewcommand{\No}{\textnumero}

     \begin{document}

     \begin{table}[H]
     \label{appA}
     \begin{tabularx}{\textwidth}{a|d|s|Y}
     \hline 
     Наименование & Основные технические данные & Кол., шт. & Примечание  \\ 
     \hline
     text text text text text text text & text text text text text text text text text text& {1} & text  \\ 
     \end{tabularx} 
     \end{table}

     \end{document}

I'll appreciate any help!

  • 1
    your codes snippets aren't very helpful. please, be so kind and merge and extent them to complete small document, called mwe (minimal working example) beginning with \documentclass{...} and ending with \end{document}. welcome to tex.se! – Zarko Oct 9 '17 at 18:52
3

As far as I understand your request, the following solves the problem (sorry for poor representation of Russian language by Latin characters):

\documentclass{article}

\usepackage{tabularx}
      \newcolumntype{Y}{>{\centering\arraybackslash}X} 
      \newcolumntype{d}{>{\centering}b{.25\textwidth}}
      \newcolumntype{s}{>{\centering}b{.1\textwidth}}
      \newcolumntype{a}{>{\centering}p{.25\textwidth}}
    \newcolumntype{c}{>{\centering}b{.25\textwidth}<{\vfill}}
\begin{document}

\begin{table}
     \label{appA}
 %    \begin{tabularx}{\textwidth}{a|d|s|Y}
    \begin{tabularx}{\textwidth}{c|d|s|Y}
     \hline 
     Naimenovanije& Osnovnyje tehniceskije dannyje & Kol.,   &sht. Primechanije  \\ 
     \hline
     text text text text text text text & text text text text text text text 
     text text text & {1} & text  \\ 
     \hline
     \end{tabularx} 
     \end{table}



\end{document}

enter image description here

  • Yes! That's exactly what I'm need! Many thanks, Przemysław Scherwentke! – Max Kashirnyy Oct 9 '17 at 19:15
2

You can avoid breaking off the last line of the paragraph "by hand" by just backing up by a line;

  %russian technichal standart documentation class
     \documentclass[russian, 14pt, utf8, columnsxxiv, columnxxxi, columnxxxii, pointsection, hpadding = 10mm]{eskdtext}

     %%%For working of eskdx, also cyrillic
     \usepackage{xecyr}

     %%%for fonts
% don't use these     \usepackage{xunicode,xltxtra}

%  this is already loaded     \usepackage{fontspec}

    \def\No{???}% undefined command in MWE 

     %%%set TNR as main font
     \setmainfont[Mapping=tex-text]{Times New Roman}

     %%%Additional position options
     \usepackage{float}

     %%%advanced tables
     \usepackage{tabularx}
     \newcolumntype{Y}{>{\centering\arraybackslash}X} %%% центрированный тип блока          ячейки для tabularx
     \newcolumntype{d}{>{\centering}p{.25\textwidth}}
     \newcolumntype{s}{>{\centering}p{.1\textwidth}}
     \newcolumntype{a}{>{\centering}p{.25\textwidth}}

     \begin{document}

     \begin{table}[H]
     \label{appA}
     \begin{tabularx}{\textwidth}{a|d|s|Y}
     \hline 
     Наименование & Основные технические данные & Кол., шт. & Примечание  \\ 
     \hline
     text text text text text text text & text text text text text text text text text text&&\\[-\normalbaselineskip]
     && {1} & text  \\ 
     \end{tabularx} 
     \end{table}

     \end{document}
  • David Carlisle, thanks! Fixed first post. Also, your variant works fine too. But there is a problem, it should be implemented to row individually. – Max Kashirnyy Oct 9 '17 at 19:39
  • @МаксКаширный why? you can make every logical row into two actual rows it just means that instead of & you use &&\\[-\normalbaselineskip]&& (which you could define to be some command \zz then your "row" would be aaa&bbb\zz ccc&dd\\ ) – David Carlisle Oct 9 '17 at 19:42
  • Ok, I got it! Thanks for explanation, then it will be very nice! – Max Kashirnyy Oct 9 '17 at 19:48

Your Answer

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

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