📜 ⬆️ ⬇️

Practical advice on the layout of application forms in LaTeHe

A few useful tricks for LaTeX lovers who want to fill out the form of any application. Let us, for example, impose a claim form on the Post of Russia (its “official” version can, if you are lucky, download from the Russian Post site ). We will not explain the entire layout from the first letter to the last letter, assuming that the reader is familiar with the basics of LaTeHa. Consider the specific recipes for the layout of the “lines” where you need to enter the missing words, checkboxes with labels, signatures in small print below the text and lines of different thickness and discontinuity.

Of course, the recipes are not the only possible and certainly something wrong. If you know how to cook better, welcome in the comments.


')

The addressee of the application

As a rule, all applications begin with a few lines in the upper right corner where the addressee and the applicant submit. This block should be pressed to the right, in the block itself left-justification and in each line there are usually several words at the beginning, after which the line goes to the end. Sometimes there are words in the middle of the line too.

The simplest code that does what you want looks like this:

\begin{flushright} %     \begin{tabular}{p{.5\textwidth}} %           \hrulefill \\ % \hrulefill       \hrulefill \end{tabular} \end{flushright} 

We modify it slightly so that the flushright, tabular and \hrulefill inserted automatically. To do this, we define new lines :

 \newenvironment{lines}[1][\textwidth] %        { \newcolumntype{E}{>{}p{#1}<{\hrulefill}} %       \hrulefill \begin{flushright} %   flushright \begin{tabular}[h]{E} %  tabular   } {\end{tabular}\end{flushright} } 

you can use it like this:

 \begin{lines}[.5\textwidth]  \\ \\ \\ \\ .\\ ,  \\  \rule{2cm}{0.25pt} â„– \\ % \rule        \end{lines} 



Tick ​​boxes

You can circle the frame with something \fbox , but how to make an empty box of the desired size, say 3 millimeters? Ways for sure a lot. You can use the minipage environment, which allows you to specify the width and height: \begin{minipage}[c][0.3cm]{0.3cm}\quad\end{minipage} , or you can use the low-level \vbox and \hbox: \vbox to 3mm {\vfil \hbox to 3mm{} \vfil} . In any case, I don’t want to write so much code every time, so let's make a new \ chkbox command and pass the text to it with the argument, which should be placed next to the checkbox.

 % \:      , %  \parbox    ,         %     calc      \newcommand\chkbox[1]{\fbox{\begin{minipage}[c][0.3cm]{0.3cm}\quad\end{minipage}}\:\parbox[t]{\linewidth - 0.3cm}{#1} } 

Place the squares on the page using the table:

 \begin{tabular}{p{.17\textwidth}p{.25\textwidth}p{.25\textwidth}p{.3\textwidth}} %      \chkbox{} & \chkbox{ \\ } & \chkbox{ } & \parbox[t]{.3\textwidth}{ \\  \hrulefill} \\ \end{tabular} 



Text below line

It is easy to make an underlined text, but how to make it “overlined”, for example, to write in small print “Last Name IO” under the field for the full name? One way is to use the \underset macro from the amsmath package:

 %  ",     "       $\underset{\text{(,     )}}{\underline{\hspace{0.5\textwidth}}}$ 



Lines

Finally, full page lines are often needed. In the layout example, a dashed line separating the tear-off coupon is required, and sometimes in statements or appeals by lines the “company” header is separated from the rest of the text (as, for example, in the letter in the picture on the right). A dash line can be made using the \hdashrule macro from the dashrule package:

 %       1 ,   2    , %   " 3   1 " \hdashrule[-2mm]{\textwidth}{1pt}{3mm 1mm} 

Solid lines can be made with the \rule command, which has the same syntax, except for the absence of the last argument (line pattern). Two solid lines of different thickness is easy to do:

 \rule{\textwidth}{.5mm} \rule{\textwidth}{.25mm} 

but the distance between them is too great. You can play \hrule with the line breaks, but it's easier to use the \hrule and install kerning:

 \hrule height 1pt\kern 2pt \hrule height 0.25pt 


Together

The finished form can be downloaded here , and to see the updated sources here

Source: https://habr.com/ru/post/207364/


All Articles