Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

How can I set a different padding value for each side? I want a result that corresponds with this HTML/CSS configuration:

<html>
<head>
  <style>
    div {
      background: #444;
      color: white;
    }

    div.padded {
      padding-top: 60px;
      padding-right: 10px;
      padding-bottom: 15px;
      padding-left: 152px;
    }
  </style>
</head>
<body>
  <div class="padded">
    Padded<br>
    Top: 10px; bottom: 0px<br>
    Left: 5em; right: 0px
  </div>
</body>
</html>

What is the exact paragraph style to set in LaTeX?

\documentclass{article} 
\usepackage{fontspec}
\usepackage{fancyhdr}
\usepackage{multicol}
\pagestyle{plain}\pagestyle{fancy}
\renewcommand{\headrulewidth}{0.4pt} \renewcommand{\footrulewidth}{0.4pt}

\begin{document} 
\thispagestyle{empty} 
\font\brbrdivpadded="Times New Roman":color=ffffff at 12pt
\font\brdivpadded="Times New Roman":color=ffffff at 12pt
\font\divpadded="Times New Roman":color=ffffff at 12pt

\divpadded{Padded }\divpadded{Top: 10px; bottom: 0px }\divpadded{Left: 5em; right: 0px }
\end{document}
share|improve this question

closed as too localized by Seamus, lockstep, Gonzalo Medina, Joseph Wright Aug 22 '11 at 6:00

This question is unlikely to help any future visitors; it is only relevant to a small geographic area, a specific moment in time, or an extraordinarily narrow situation that is not generally applicable to the worldwide audience of the internet. For help making this question more broadly applicable, visit the help center.If this question can be reworded to fit the rules in the help center, please edit the question.

6  
I think you need to read The not so short introduction to LaTeX. It's clear from this question that you don't really understand how LaTeX works. –  Seamus Aug 8 '11 at 10:01
6  
Can you show us some attempt you've made in achieving this configuration? Is there something in particular you're struggling with? This Q&A site is about solving problems, not about having other people do your work (even though sometimes it seems tex.sx users will do anything as long as it is about TeX). If you don't know at all how to go about changing this, I second Seamus' recommendation to read some introductory text on LaTeX. –  doncherry Aug 8 '11 at 10:53
1  
The upcoming version of adjustbox provides a \marginbox{<llx> <lly> <urx> <usry>}{..} macro which can be used to add the padding. Also have a look on the mdframed or the older framed package. But LaTeX and HTML/CSS work under complete different principles, so a little more context would help understanding your needs. –  Martin Scharrer Aug 8 '11 at 10:54
    
For code blocks, every line needs to be preceded by four spaces. The easiest way to do this is to select the code and press the {} button. –  Jake Aug 9 '11 at 6:20
add comment

1 Answer

I give you a template that simulates your HTML but it is not so similar. :-) Adjust it gradually while you are learning TeX and getting familiar with it.

enter image description here

\documentclass[dvipsnames,rgb]{article}
\usepackage{xcolor}
\usepackage
[
    paperwidth=1024pt,
    paperheight=768pt,
    left=60pt,
    right=60pt,
    top=60pt,
    bottom=60pt
]{geometry}

\pagecolor{Yellow!50}% page color
\color{Maroon}% text color


\usepackage{lipsum}%dummy text

\usepackage[demo]{graphicx}% import graphics

\begin{document}
\section{Introduction to \LaTeX}
\lipsum[1]
\[E\not=mc^2\]
\lipsum[2]
\begin{figure}[hbtp]
\centering
\includegraphics[width=0.5\linewidth]{foo}
\caption{Dummy Figure}
\end{figure}
\lipsum[3]

\section{Introduction to PSTricks}
\lipsum[4]
\end{document}
share|improve this answer
add comment

Not the answer you're looking for? Browse other questions tagged or ask your own question.