%20Como%20centralizar%20o%20texto%2C%20mas%20alinhado%20%C3%A0%20esquerda%3F.png)
Estou tentando criar um cabeçalho para meu documento de tese. Requer que o texto esteja alinhado à esquerda, mas centralizado, assim:
Eu tentei fazer isso com esta abordagem:
\documentclass[12pt]{report}
%other packages
\usepackage{fancyhdr}
\pagestyle{fancy}
\renewcommand{\headrulewidth}{0pt}
\renewcommand{\footrulewidth}{0pt}
% ------- PORTADA -------
\title{PORTADA}
\author{}
\date{}
\begin{document}
\maketitle
\fancyhead{}
\fancyfoot{}
\fancyhead[L]{\centering{Some text
some really long long long long text
other long looong text}}
\fancyhead[R]{Some text
}
\fancyheadoffset[lh]{2cm}
E o resultado é este:
Como posso conseguir isso?
Responder1
Você pode colocar o material em uma célula centralizada de uma tabela (e remover o espaço entre as colunas para @{}
que o texto fique imediatamente na margem esquerda).
Eu adicionei oquadro de exibiçãopacote para melhor visualização do layout.
\documentclass[12pt]{report}
%other packages
\usepackage{showframe} % to show the frames of the page
\usepackage{fancyhdr}
\pagestyle{fancy}
\renewcommand{\headrulewidth}{0pt}
\renewcommand{\footrulewidth}{0pt}
\fancyhead{}
\fancyfoot{}
\fancyhead[L]{\begin{tabular}{@{}c}
Some text \\
some really long long long long text\\
other long looong text
\end{tabular}}
\fancyhead[R]{Some text}
% dimensions suggested by the fancyhdr package when theses two lines are commented
\setlength{\headheight}{43.5pt}
\addtolength{\topmargin}{-2pt}
\usepackage{lipsum} % dummy text
% ------- PORTADA -------
\title{PORTADA}
\author{}
\date{}
\begin{document}
\maketitle
\lipsum[1]
\end{document}