0

I am redoing the logos (in word) used by my school, I have managed to align the images and the text, but, I can not find the correct value to move the horizontal rule and join it with the vertical rule. At first sight they seem to be united, but, a little "zoom" notes that they are separated. I have tried with several values in \rule[...], but none has worked. This is the MWE:

\documentclass[10pt]{article}%
\usepackage[osf]{libertine}
\usepackage[margin=0.6in,noheadfoot,papersize={8.5in,13in}]{geometry}
\usepackage[most]{tcolorbox}
\usepackage{adjustbox}
%\setlength{\parindent}{0pt} % some need a parindent

% box for save dimension
\newsavebox\mysavebox
\sbox\mysavebox{\includegraphics[width=1.45cm,height=1.88cm]{example-image-a}}

% \colelogo
\NewDocumentCommand\colelogo{}{%
\noindent\adjustbox{valign=t}{\noindent\begin{minipage}[t][\ht\mysavebox][t]{0.1\linewidth}%
\usebox\mysavebox%
\end{minipage}}}%

% \coledescript
\NewDocumentCommand\coledescript{}{%
\begin{adjustbox}{minipage=[t][\ht\mysavebox][t]{0.7\linewidth}}%
    \begin{center}
        \strut\textsc{\bfseries\Large Colegio XXXXXXXXXX YYYYYY de XXXXX}\par\vspace{0.5pt}
        \emph{Enseñanza Básica}\par\vspace{0.5pt}
        \emph{Formando Personas}\par
        \vfill
        \sffamily Avenida YYYYYY XXXXXXXXX Nª 123 Fono: (12) 325678 XXXXXXXXXXX%
    \end{center}
\end{adjustbox}}%

% \coleyear
\NewDocumentCommand\coleyear{}{%
\begin{adjustbox}{minipage=[t][\ht\mysavebox][t]{0.1\linewidth}}%
    \begin{center}
        \strut\bfseries\Large 2018%
    \end{center}
\end{adjustbox}}%

% \colenota
\NewDocumentCommand\colenota{}{%
\adjustbox{valign=t}{\noindent\begin{minipage}[t][\ht\mysavebox][t]{0.1\linewidth}%
    \begin{flushright}
        \tcbox[colback=white,left=0mm,right=0mm,top=0mm,bottom=0mm,%
               boxsep=0mm,arc=2mm,boxrule=0.7pt,title style={draw=none,fill=none}]{%
         \rule{0pt}{\ht\mysavebox}\rule{\wd\mysavebox}{0pt}} % vertical x horizontal
    \end{flushright}
\end{minipage}}}%

% \colevrule
\NewDocumentCommand\colevrule{}{%
\rule[-0.9\ht\mysavebox]{0.4pt}{1.1\ht\mysavebox}\hspace{-4pt}}

% A headcole command
\NewDocumentCommand\headcole{s}{%
\setlength{\fboxsep}{0pt}
\colelogo\coledescript\colevrule\coleyear%
  \IfBooleanTF{#1}
    {\par\noindent\rule{\linewidth}{0.4pt}\par} % with a star
    {\par\noindent\hfil\rule{0.8\textwidth}{0.4pt}\hfil\par} % without a star
}

% A headprueba command
\NewDocumentCommand\headprueba{s}{%
\setlength{\fboxsep}{0pt}
\colelogo\coledescript\colevrule\coleyear\colenota
  \IfBooleanTF{#1}
    {\par\noindent\rule{\linewidth}{0.4pt}\par} % with a star
    {\par\noindent\hfil\rule{0.8\textwidth}{0.4pt}\hfil\par} % without a star
}

\pagestyle{empty}
\begin{document}
Use \verb|\headcole|...OK

\headcole
text text text text text text text text text text text text text text text 
text text text text text text text text text text text text text text text 
text text text text text text text text text text

\vspace{1cm}

Use \verb|\headcole*|...OK

\headcole*
text text text text text text text text text text text text text text text 
text text text text text text text text text text text text text text text 
text text text text text text text text text text
\vspace{1cm}

Use \verb|\headprueba|...OK

\headprueba
text text text text text text text text text text text text text text text 
text text text text text text text text text text text text text text text 
text text text text text text text text text text
\vspace{1cm}

Use \verb|\headprueba*|...OK

\headprueba*
text text text text text text text text text text text text text text text 
text text text text text text text text text text text text text text text 
text text text text text text text text text text
\end{document}

I use the libertine font and the documents are in 10pt, 11pt, 12pt and the paper size is the one used in my country (they are not enough in the MWE). An image to clarify more: MWE whit rules not join Saludos

  • Couldn't you just use a simple tabularx for that? – user121799 May 19 '18 at 2:01
  • @marmot: tabularx It's an option, but, this will be part of a package that I'll use for tests and exams ... I'm more used to minipage, but, I do not rule it out :) – Pablo González L May 19 '18 at 2:38
  • I see. (Of course you are loading tcolorbox, which in turn loads tons of other packages, in particular TikZ, which may allow you to build a more straightforward solution, possibly by also loading tikzpagenodes.) – user121799 May 19 '18 at 3:14
1

This solution replaces some of the \pars with \hrule height0pt which packs tight. Also put some of the \rules inside \smash to remove the vertical space reserved (essentially \baselineskip).

\documentclass[10pt]{article}%
%\usepackage[osf]{libertine}% took too long to download
\usepackage[margin=0.6in,noheadfoot,papersize={8.5in,13in}]{geometry}
\usepackage[most]{tcolorbox}
\usepackage{adjustbox}
%\setlength{\parindent}{0pt} % some need a parindent

% box for save dimension
\newsavebox\mysavebox
\sbox\mysavebox{\includegraphics[width=1.45cm,height=1.88cm]{example-image-a}}

% \colelogo
\NewDocumentCommand\colelogo{}{%
\noindent\adjustbox{valign=t}{\noindent\begin{minipage}[t][\ht\mysavebox][t]{0.1\linewidth}%
\usebox\mysavebox%
\end{minipage}}}%

% \coledescript
\NewDocumentCommand\coledescript{}{%
\begin{adjustbox}{minipage=[t][\ht\mysavebox][t]{0.7\linewidth}}%
    \begin{center}
        \strut\textsc{\bfseries\Large Colegio XXXXXXXXXX YYYYYY de XXXXX}\par\vspace{0.5pt}
        \emph{Enseñanza Básica}\par\vspace{0.5pt}
        \emph{Formando Personas}\par
        \vfill
        \sffamily Avenida YYYYYY XXXXXXXXX Nª 123 Fono: (12) 325678 XXXXXXXXXXX%
    \end{center}
\end{adjustbox}}%

% \coleyear
\NewDocumentCommand\coleyear{}{%
\begin{adjustbox}{minipage=[t][\ht\mysavebox][t]{0.1\linewidth}}%
    \begin{center}
        \strut\bfseries\Large 2018%
    \end{center}
\end{adjustbox}}%

% \colenota
\NewDocumentCommand\colenota{}{%
\adjustbox{valign=t}{\noindent\begin{minipage}[t][\ht\mysavebox][t]{0.1\linewidth}%
    \begin{flushright}
        \tcbox[colback=white,left=0mm,right=0mm,top=0mm,bottom=0mm,%
               boxsep=0mm,arc=2mm,boxrule=0.7pt,title style={draw=none,fill=none}]{%
         \rule{0pt}{\ht\mysavebox}\rule{\wd\mysavebox}{0pt}} % vertical x horizontal
    \end{flushright}
\end{minipage}}}%

% \colevrule
\NewDocumentCommand\colevrule{}{%
\rule[-0.9\ht\mysavebox]{0.4pt}{1.1\ht\mysavebox}\hspace{-4pt}}

% A headcole command
\NewDocumentCommand\headcole{s}{%
\setlength{\fboxsep}{0pt}%
\colelogo\coledescript\colevrule\coleyear%
  \IfBooleanTF{#1}%
    {\hrule height0pt \smash{\rule{\textwidth}{0.4pt}}\par}% with a star
    {\hrule height0pt \hfil\smash{\rule{0.8\textwidth}{0.4pt}}\hfil\par}% without a star
}

% A headprueba command
\NewDocumentCommand\headprueba{s}{%
\setlength{\fboxsep}{0pt}
\colelogo\coledescript\colevrule\coleyear\colenota
  \IfBooleanTF{#1}
    {\hrule height0pt \smash{\rule{\linewidth}{0.4pt}}\par} % with a star
    {\hrule height0pt \hfil\smash{\rule{0.8\textwidth}{0.4pt}}\hfil\par} % without a star
}

\pagestyle{empty}
\begin{document}
Use \verb|\headcole|...OK

\headcole
text text text text text text text text text text text text text text text 
text text text text text text text text text text text text text text text 
text text text text text text text text text text

\vspace{1cm}

Use \verb|\headcole*|...OK

\headcole*
text text text text text text text text text text text text text text text 
text text text text text text text text text text text text text text text 
text text text text text text text text text text
\vspace{1cm}

Use \verb|\headprueba|...OK

\headprueba
text text text text text text text text text text text text text text text 
text text text text text text text text text text text text text text text 
text text text text text text text text text text
\vspace{1cm}

Use \verb|\headprueba*|...OK

\headprueba*
text text text text text text text text text text text text text text text 
text text text text text text text text text text text text text text text 
text text text text text text text text text text
\end{document}
  • Thanks for the answer, you can tell me how to fix the \rule{0.8\textwidth}{0.4pt}, it is not centered as it should... – Pablo González L May 19 '18 at 2:36
  • Replace \smash rule for {\hrule height0pt \begingroup\centering\rule{0.8\linewidth}{0.4pt}\par\endgroup} % without a star and now it works perfectly ... Thank you very much – Pablo González L May 19 '18 at 5:05
  • Interestng. When i did that it was left justified, not centered relative to the page. – John Kormylo May 19 '18 at 12:51

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.