3

How can I do this in an easy way using pstricks or tikz , i cant put the text in the right place

enter image description here

my MWE

\documentclass[a4paper]{article}
\usepackage[margin=1.5cm]{geometry}
\usepackage[x11names]{xcolor}
\usepackage{fancyhdr}
\usepackage{pstricks,pstricks-add,graphicx}
\pagestyle{fancy}
\renewcommand{\headrulewidth}{0pt}
\renewcommand{\baselinestretch}{1.3}
\setlength{\parindent}{0cm}
\psset{linecolor=red}
\begin{document}
\psframe(-0.2,1.1)(1.007\textwidth ,-\textheight)
\psline{}(-0.2,-2)(1.007\textwidth ,-2)
\psline{}(0.5\textwidth ,1.1)(0.5\textwidth ,-2)

\begin{minipage}[t]{0.48\textwidth}

\end{minipage}
\hfill
\begin{minipage}[t]{0.48\textwidth}

\end{minipage}

\psline{}(-0.2,0)(1.007\textwidth ,0)
\psline{}(-0.2,-1)(1.007\textwidth ,-1)
\psline{}(0.65\textwidth ,0)(0.65\textwidth ,-21.3)

%===================================================
\begin{minipage}[t]{0.64\textwidth}

\end{minipage}
%===================================================
\hfill
%===================================================
\begin{minipage}[t]{0.3\textwidth}

\end{minipage}
%===================================================
\end{document}
Salim Bou
  • 17,021
  • 2
  • 31
  • 76

1 Answers1

2

Here is a tikz solution. First consider the result:

Result

The lines in the grid are drawn between coordinates previously defined to give flexibilty. For example, the horizontal line below the text "Middle part" is at 20% of the table height, the vertical line separating "Bottom part left" and "Bottom part right" is at 33% of the table width.

The line above "Middle part", however, is not a percentage of the table, but it is instead defined in such a way that the cells "Top part" and "Middle part" have the same height. The line below "Left header" and "Right header" is fixed to give those cells 1cm height.

The text is placed at the middle of each cell, but it should be "short text". Otherwise you'll have to give it a text width key to allow the paragraph to be properly formatted.

Here is the code:

\documentclass[a4paper]{article}
\usepackage[margin=1.5cm]{geometry}
\usepackage[x11names]{xcolor}
\usepackage{tikz}
\usetikzlibrary{calc}
\begin{document}
\begin{tikzpicture}[remember picture, overlay]\Large

    % Coordinates of the external frame
    \coordinate (top) at ($(current page.north)+(0,-1.5)$);
    \coordinate (bottom) at ($(current page.south)+(0,1.5)$);
    \coordinate (left) at ($(current page.west)+(1.5,0)$);
    \coordinate (right) at ($(current page.east)+(-1.5,0)$);

    % Coordinates of the horizontal parts
    \coordinate (middle part) at ($(top)!.20!(bottom)$);
    \coordinate (top part) at ($(top)!.5!(middle part)$);
    \coordinate (bottom part header) at ($(middle part)+(0,-1)$);
    \coordinate (left part) at ($(left)!.33!(right)$);
    \coordinate (half part) at ($(left)!.50!(right)$);

    % Frame around
    \draw[red] (bottom-|left) rectangle (top-|right);
    % Horizontal lines
    \draw[red] (top part-|left) -- (top part-|right);
    \draw[red] (middle part-|left) -- (middle part-|right);
    \draw[red] (bottom part header-|left) -- (bottom part header-|right);

    % Vertical lines
    \draw[red] (top-|half part) -- (top part-|half part);
    \draw[red] (middle part-|left part) -- (bottom-|left part);

    \node at ($(top-|left)!.5!(top part-|half part)$) {Top part middle left};
    \node at ($(top-|right)!.5!(top part-|half part)$) {Top part middle right};
    \node at ($(top part-|half part)!.5!(middle part-|half part)$) {Middle part};
    \node at ($(middle part-|left)!.5!(bottom part header-|left part)$) {Left header};
    \node at ($(middle part-|right)!.5!(bottom part header-|left part)$) {Right header};
    \node at ($(bottom part header-|left)!.5!(bottom-|left part)$) {Bottom part left};
    \node at ($(bottom part header-|right)!.5!(bottom-|left part)$) {Bottom part right};
\end{tikzpicture}
\end{document}
JLDiaz
  • 55,732