1

I'm learning to use LateX, but I'm finding some problems. I'm currently tryng to create a table, rotate it, but I don't understand how to center it in the A4 page of the report I've to produce, and adjust the size. Like the example in the pictureenter image description here

Instead, I get this. I've yet to fill it with data, but it's not centered. Also, how do I put Bold letters in the cells? Just by using the command ?

 \documentclass[a4paper,12pt,titlepage]{report}

\author{Luca Pinsuti}
\usepackage[english]{babel}
\usepackage[utf8x]{inputenc}

\usepackage{lmodern}
\usepackage[T1]{fontenc}

\usepackage{graphicx}
\usepackage{wrapfig}
\usepackage{lipsum}
\usepackage{listings}
\usepackage{verbatimbox}
\usepackage{listings}
\usepackage[usenames]{color}
\usepackage{ragged2e}

\usepackage{pdflscape}


\usepackage{amstext} % for \text macro
\usepackage{array}   % for \newcolumntype macro
\newcolumntype{L}{>{$}l<{$}} % math-mode version of "l" column type

\newcolumntype{C}{>{$}c<{$}} % math-mode version of "c" column type


\newcolumntype{R}{>{$}r<{$}} % math-mode version of "r" column type


\usepackage[toc,page]{appendix}



\usepackage[table,xcdraw]{xcolor}

\lstnewenvironment{codice_arduino}[1][]
{\lstset{basicstyle=\small\ttfamily, columns=fullflexible,
keywordstyle=\color{red}\bfseries, commentstyle=\color{blue},
language=C++, basicstyle=\small,
numbers=left, numberstyle=\tiny,
stepnumber=2, numbersep=5pt, frame=shadowbox, float=*, #1}}{}



%% Sets page size and margins
\usepackage[a4paper,top=3cm,bottom=2cm,left=3cm,right=3cm,marginparwidth=1.75cm]{geometry}

%% Useful packages
\usepackage{amsmath}
\usepackage{graphicx}
\usepackage[colorinlistoftodos]{todonotes}
\usepackage[colorlinks=true, allcolors=black]{hyperref}
\usepackage{amssymb}
\usepackage{siunitx}
\usepackage{caption}
\usepackage{booktabs}
\usepackage{float}

\begin{document}
\begin{landscape}
\begin{tabular}{|L|L|L|L|L|L|L|L|L|L|L|}
\hline
Circuit & A & Q_{des} & l & T_{floor} & Ta & K_H & T_{out} & \sigma & \Delta T_{log} & Q \\ 
\hline
Rooms & m^2 & W/m^2 & m & °C & °C & w/m^2*K & °C & °C & °C & W \\ 
\hline
 &  &  &  &  &  &  &  &  &  &  \\ 
\hline
 &  &  &  &  &  &  &  &  &  &  \\ 
\hline
 &  &  &  &  &  &  &  &  &  &  \\ 
\hline
 &  &  &  &  &  &  &  &  &  &  \\ 
\hline
 &  &  &  &  &  &  &  &  &  &  \\ 
\hline
\end{tabular}
\end{landscape}

\end{document}
  • 3
    Welcome to TeX.SX! Please help us help you and add a minimal working example (MWE) that illustrates your problem. Reproducing the problem and finding out what the issue is will be much easier when we see compilable code, starting with \documentclass{...} and ending with \end{document}. – user36296 Sep 2 '17 at 14:58
  • 3
    P.S. please don't show code as an image, but as text so it can be copied. – user36296 Sep 2 '17 at 14:59
  • 2
    welcome to tex. se! from your screenshot we can only gues what is going on. please, show us code of your table in form of small, nut complete code, which we can copy to our computers and test it. so, for now i can only advice you to read some introduction text about latex as is tobi.oetiker.ch/lshort/lshort.pdf – Zarko Sep 2 '17 at 15:01
  • 2
    to centre the tabular put \centering before it and to make a word like Rooms bold, use \textbf{Rooms} – David Carlisle Sep 2 '17 at 15:24
  • @LucaPinsuti In addition David Carlisle comment, you can use \vspace*{\fill} before and after the tabular to get it vertically centred. – user36296 Sep 3 '17 at 11:37
1
  • width of table, as it is generated by provided code, is smaller than width of text, so there is no need to be set in landscape orientation.
  • in it i would exploit siunitx packages for column type as well for units
  • to my taste table will look nicer, if the vertical lines would be omitted and for horizontal used rules defined in booktabs package.
  • also with @{\extracolsep{\fill}} i would expand table width to text width

enter image description here

\documentclass[a4paper,12pt,titlepage]{report}
\usepackage[showframe,
            a4paper,
            vmargin={3cm,2cm},
            hmargin=3cm,
            marginparwidth=1.75cm]{geometry}
\usepackage{pdflscape}

\usepackage{array, booktabs}   % for \newcolumntype macro
%\usepackage[table,xcdraw]{xcolor}

\usepackage{siunitx}
\usepackage[colorlinks=true, allcolors=black]{hyperref}% had to be last in preamble

\begin{document}
\begin{table} % \begin{landscape}
%\centering
\renewcommand\arraystretch{1.2}
\begin{tabular*}{\linewidth}{@{\extracolsep{\fill}} l *{10}{s} }
    \toprule%\hline
Circuit & {A}   & {Q_{\mathrm{des}}}    & {l}
                & {T_{\mathrm{floor}}}  & {T_a}     & {K_H}
                & {T_{\mathrm{out}}}    & \sigma    & {\Delta T_{\log}} & Q \\
    \midrule%\hline
Rooms &  m^2  & W/m^2 & m & \celsius & \celsius & w/m^2\cdot K & \celsius & \celsius & \celsius & W \\
    %\hline
Rooms &  m^2  & W/m^2 & m & \celsius & \celsius & w/m^2\cdot K & \celsius & \celsius & \celsius & W \\
%\hline
 &  &  &  &  &  &  &  &  &  &  \\
%\hline
 &  &  &  &  &  &  &  &  &  &  \\
%\hline
 &  &  &  &  &  &  &  &  &  &  \\
%\hline
 &  &  &  &  &  &  &  &  &  &  \\
    \bottomrule%\hline
\end{tabular*}
\end{table} %\end{landscape}

\end{document}

note: in above mwe i preserve only packages from yours mwe which are necessary for this table. exception is hyperref, where i try to emphasize that (with rare exception) had to be last in preamble.

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.