renewcommand

Latex renewcommand not working properly

Why is this not working: \documentclass[a4paper,10pt]{article} \usepackage{a4wide} \usepackage[T1]{fontenc} \usepackage[portuguese]{babel} \usepackage[latin1]{inputenc} \usepackage{indentfirst} \usepackage{listings} \usepackage{fancyhdr} \usepackage{url} \usepackage[compat2,a4paper,left=25mm,right=25mm,bottom=15mm,top=20mm]{geometry} \u...

\newcommand / \newenvironment - optional parameters

I'm experimenting with my own commands and environments and now I'm facing those problems: How to create command \foo{parameter}[optional] or environment called \begin{bar}{parameter}[optional]? How to create command \foo[optional_1]...[optional_n]{parameter} I've tried \newcommand{\foo}[3][][]{#1#2#3} - failed \newcommand{\foo}[...